

This example creates an inline array of integers, and demonstrates the difference between eina\+\_\+inarray\+\_\+insert and eina\+\_\+inarray\+\_\+sort, and eina\+\_\+inarray\+\_\+search and eina\+\_\+inarray\+\_\+search\+\_\+sort. \mbox{\hyperlink{eina_inarray_example_01}{Eina inline array usage}}.

We start with some variable declarations and eina initialization\+: 
\begin{DoxyCodeInclude}{0}
\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}{int} a, *b;}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_ga81b8137665b8a4d2cb38ca50017d4c74}{eina\_init}}();}

\end{DoxyCodeInclude}
 We then create the array much like we did on \mbox{\hyperlink{eina_inarray_example_01}{Eina inline array usage}} \+: 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{   iarr = \mbox{\hyperlink{group__Eina__Inline__Array__Group_gab90ef5e018c9e18341d5057254fd2f5b}{eina\_inarray\_new}}(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}), 0);}

\end{DoxyCodeInclude}
 We then add an element using eina\+\_\+inarray\+\_\+insert and print. Then remove that element and add it again using eina\+\_\+inarray\+\_\+insert\+\_\+sorted and print. This shows the 2 different positions the element gets added. Then search for an element in the unsorted array using eina\+\_\+inarray\+\_\+search, then sorts the array and then searches the same element using eina\+\_\+inarray\+\_\+search\+\_\+sorted. 
\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{   a = 1;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga1546c690e7e63307af20f7ac3db1b095}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 9;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga1546c690e7e63307af20f7ac3db1b095}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 6;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga1546c690e7e63307af20f7ac3db1b095}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 4;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga1546c690e7e63307af20f7ac3db1b095}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{   a = 10;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga1546c690e7e63307af20f7ac3db1b095}{eina\_inarray\_push}}(iarr, \&a);}
\DoxyCodeLine{}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Inline array of integers with \%d elements:\(\backslash\)n"{}}, \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga63333e28eaa59cf00bc748b3df55bad7}{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{   a = 8;}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_gab8dab6c26190fa6802cf5a02922e8005}{eina\_inarray\_insert}}(iarr, \&a, cmp);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Inserting \%d to inline array using eina\_inarray\_insert.\(\backslash\)n"{}}, a);}
\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_ga67a940f746887b7c51f4e2522a371b82}{eina\_inarray\_remove}}(iarr, \&a);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Removed \%d from inline array using eina\_inarray\_remove.\(\backslash\)n"{}}, a);}
\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_ga8fb844f63ddda56260624756942d3e6e}{eina\_inarray\_insert\_sorted}}(iarr, \&a, cmp);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Inserting \%d to inline array using eina\_inarray\_insert\_sorted.\(\backslash\)n"{}},a);}
\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{   printf(\textcolor{stringliteral}{"{}Position of element \%d in the inline array is \%d\(\backslash\)n"{}}, a, \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga9b2d972e4eb71a2cb9ab7d42e841c994}{eina\_inarray\_search}}(iarr, \&a, cmp));}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga4e481a04c6a0f677722d810c3a6f41d8}{eina\_inarray\_sort}}(iarr, cmp);}
\DoxyCodeLine{   printf(\textcolor{stringliteral}{"{}Sorted inline array:\(\backslash\)n"{}});}
\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{   printf(\textcolor{stringliteral}{"{}Position of element \%d in the sorted inline array is \%d\(\backslash\)n"{}}, a, \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga9a6e430eb275cfa62d440976bdb96cd3}{eina\_inarray\_search\_sorted}}(iarr, \&a, cmp));}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Inline__Array__Group_ga030924ac7ef1ce357b328e4a40e5f77f}{eina\_inarray\_free}}(iarr);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Eina__Main__Group_ga5bf35513199d5220341437c05696285d}{eina\_shutdown}}();}
\DoxyCodeLine{\}}

\end{DoxyCodeInclude}
 The source for this example\+: \mbox{\hyperlink{eina_inarray_03_c}{eina\+\_\+inarray\+\_\+03.\+c}} 