\hypertarget{eina_inarray_01_8c-example}{}\doxysection{eina\+\_\+inarray\+\_\+01.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{\textcolor{comment}{//Compile with:}}
\DoxyCodeLine{\textcolor{comment}{//gcc -\/g eina\_inarray\_01.c -\/o eina\_inarray\_01 `pkg-\/config -\/-\/cflags -\/-\/libs eina`}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <\mbox{\hyperlink{Eina_8h}{Eina.h}}>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}}
\DoxyCodeLine{cmp(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *a, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *b)}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} *(\textcolor{keywordtype}{int}*)a > *(\textcolor{keywordtype}{int}*)b;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Eina__Inarray}{Eina\_Inarray}} *iarr;}
\DoxyCodeLine{   \textcolor{keywordtype}{char} ch, *ch2;}
\DoxyCodeLine{   \textcolor{keywordtype}{int} a, *b;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_gafee4bfc0e509b6ffed6598edf6f4b3de}{eina\_init}}();}
\DoxyCodeLine{   iarr = \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga38a116a1355055b470c31bb4f633e53b}{eina\_inarray\_new}}(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char}), 0);}
\DoxyCodeLine{}
\DoxyCodeLine{   ch = \textcolor{charliteral}{'a'};}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&ch);}
\DoxyCodeLine{   ch = \textcolor{charliteral}{'b'};}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&ch);}
\DoxyCodeLine{   ch = \textcolor{charliteral}{'c'};}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&ch);}
\DoxyCodeLine{   ch = \textcolor{charliteral}{'d'};}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&ch);}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Inline array of chars:\(\backslash\)n"});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}}(iarr, ch2)}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"char: \%c(pointer: \%p)\(\backslash\)n"}, *ch2, ch2);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga4e2b2a5b7d01613db5b578d8dbec36b7}{eina\_inarray\_flush}}(iarr);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga97ceb13e335d8b8aae8dfcce735ec274}{eina\_inarray\_step\_set}}(iarr, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{struct__Eina__Inarray}{Eina\_Inarray}}), \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}), 4);}
\DoxyCodeLine{}
\DoxyCodeLine{   a = 97;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 98;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 100;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 99;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga3dfa2e214c3cf3363f6ed390da4221c3}{eina\_inarray\_insert\_sorted}}(iarr, \&a, cmp);}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"Inline array of integers with \%d elements:\(\backslash\)n"}, \mbox{\hyperlink{group__Eina__Inline__Array__Group_gaf6d3ce4a7b0b8e521e2c91024065d97d}{eina\_inarray\_count}}(iarr));}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}}(iarr, b)}
\DoxyCodeLine{     printf(\textcolor{stringliteral}{"int: \%d(pointer: \%p)\(\backslash\)n"}, *b, b);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga369b3090b7c04377eaceb6bebfe36e06}{eina\_inarray\_free}}(iarr);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_ga2c8b4020427108a30c44707af22c99d3}{eina\_shutdown}}();}
\DoxyCodeLine{\}}
\end{DoxyCodeInclude}
 