
\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -g eina\_inarray\_03.c -o eina\_inarray\_03 `pkg-config --cflags --libs eina`}

\textcolor{preprocessor}{#include <\hyperlink{Eina_8h}{Eina.h}>}

\textcolor{keywordtype}{int}
cmp(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *a, \textcolor{keyword}{const} \textcolor{keywordtype}{void} *b)
\{
   \textcolor{keywordflow}{return} *(\textcolor{keywordtype}{int}*)a > *(\textcolor{keywordtype}{int}*)b;
\}

\textcolor{keywordtype}{int} main(\textcolor{keywordtype}{int} argc EINA\_UNUSED, \textcolor{keywordtype}{char} **argv EINA\_UNUSED)
\{
   Eina\_Inarray *iarr;
   \textcolor{keywordtype}{int} a, *b;

   \hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}();
   iarr = \hyperlink{group__Eina__Inline__Array__Group_ga38a116a1355055b470c31bb4f633e53b}{eina\_inarray\_new}(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{int}), 0);

   a = 1;
   \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, &a);
   a = 9;
   \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, &a);
   a = 6;
   \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, &a);
   a = 4;
   \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, &a);
   a = 10;
   \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, &a);

   printf(\textcolor{stringliteral}{"Inline array of integers with %d elements:\(\backslash\)n"}, \hyperlink{group__Eina__Inline__Array__Group_gaf6d3ce4a7b0b8e521e2c91024065d97d}{eina\_inarray\_count}(iarr));
   \hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}(iarr, b)
     printf("\textcolor{keywordtype}{int}: %d(pointer: %p)\(\backslash\)n", *b, b);

   a = 8;
   \hyperlink{group__Eina__Inline__Array__Group_ga55e20eb249332bac73809fe171f0a5a5}{eina\_inarray\_insert}(iarr, &a, cmp);
   printf("Inserting %d to inline array using \hyperlink{group__Eina__Inline__Array__Group_ga55e20eb249332bac73809fe171f0a5a5}{eina\_inarray\_insert}.\(\backslash\)n", a);
   \hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}(iarr, b)
     printf("\textcolor{keywordtype}{int}: %d(pointer: %p)\(\backslash\)n", *b, b);

   \hyperlink{group__Eina__Inline__Array__Group_ga4075a8845cdc9ea50df235e331f079fc}{eina\_inarray\_remove}(iarr, &a);
   printf("Removed %d from inline array using \hyperlink{group__Eina__Inline__Array__Group_ga4075a8845cdc9ea50df235e331f079fc}{eina\_inarray\_remove}.\(\backslash\)n", a);
   \hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}(iarr, b)
     printf("\textcolor{keywordtype}{int}: %d(pointer: %p)\(\backslash\)n", *b, b);

   \hyperlink{group__Eina__Inline__Array__Group_ga3dfa2e214c3cf3363f6ed390da4221c3}{eina\_inarray\_insert\_sorted}(iarr, &a, cmp);
   printf("Inserting %d to inline array using \hyperlink{group__Eina__Inline__Array__Group_ga3dfa2e214c3cf3363f6ed390da4221c3}{eina\_inarray\_insert\_sorted}.\(\backslash\)n",a);
   \hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}(iarr, b)
     printf("\textcolor{keywordtype}{int}: %d(pointer: %p)\(\backslash\)n", *b, b);

   printf("Position of element %d in the inline array is %d\(\backslash\)n", a, 
      \hyperlink{group__Eina__Inline__Array__Group_gadbd0ce893a32d7d24ff7662a15d88c5b}{eina\_inarray\_search}(iarr, &a, cmp));

   \hyperlink{group__Eina__Inline__Array__Group_ga485250d8aef53c5648238e94987f58cc}{eina\_inarray\_sort}(iarr, cmp);
   printf("Sorted inline array:\(\backslash\)n");
   \hyperlink{group__Eina__Inline__Array__Group_gab6ffcad27b5099aa34af9ecd5e2b22f9}{EINA\_INARRAY\_FOREACH}(iarr, b)
     printf("\textcolor{keywordtype}{int}: %d(pointer: %p)\(\backslash\)n", *b, b);

   printf("Position of element %d in the sorted inline array is %d\(\backslash\)n", a, 
      \hyperlink{group__Eina__Inline__Array__Group_gadd55e832494d0c261fd6e6604abb6cf6}{eina\_inarray\_search\_sorted}(iarr, &a, cmp));

   \hyperlink{group__Eina__Inline__Array__Group_ga369b3090b7c04377eaceb6bebfe36e06}{eina\_inarray\_free}(iarr);
   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();
\}
\end{DoxyCodeInclude}
 