\hypertarget{eina_array_02_8c-example}{}\section{eina\+\_\+array\+\_\+02.\+c}

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

\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <string.h>}

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

\hyperlink{group__Eina__Types__Group_ga3fe0caf72e93b1bab1ca8ee3ccf3f226}{Eina\_Bool} keep(\textcolor{keywordtype}{void} *data, \textcolor{keywordtype}{void} *gdata \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED})
\{
   \textcolor{keywordflow}{if} (strlen((\textcolor{keyword}{const} \textcolor{keywordtype}{char}*)data) <= 5)
      \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE};
   \textcolor{keywordflow}{return} \hyperlink{group__Eina__Types__Group_ga1feb115f8e9913e806e090d9bd5a7301}{EINA\_FALSE};
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}, \textcolor{keywordtype}{char} **argv \hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED})
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}* strs[] = \{
      \textcolor{stringliteral}{"one"}, \textcolor{stringliteral}{"two"}, \textcolor{stringliteral}{"three"}, \textcolor{stringliteral}{"four"}, \textcolor{stringliteral}{"five"}, \textcolor{stringliteral}{"six"}, \textcolor{stringliteral}{"seven"}, \textcolor{stringliteral}{"eight"}, \textcolor{stringliteral}{"nine"},
      \textcolor{stringliteral}{"ten"}, \textcolor{stringliteral}{"eleven"}, \textcolor{stringliteral}{"twelve"}, \textcolor{stringliteral}{"thirteen"}, \textcolor{stringliteral}{"fourtenn"}, \textcolor{stringliteral}{"fifteen"}, \textcolor{stringliteral}{"sixteen"},
      \textcolor{stringliteral}{"seventeen"}, \textcolor{stringliteral}{"eighteen"}, \textcolor{stringliteral}{"nineteen"}, \textcolor{stringliteral}{"twenty"}
   \};
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}* strings[] = \{
      \textcolor{stringliteral}{"helo"}, \textcolor{stringliteral}{"hera"}, \textcolor{stringliteral}{"starbuck"}, \textcolor{stringliteral}{"kat"}, \textcolor{stringliteral}{"boomer"},
      \textcolor{stringliteral}{"hotdog"}, \textcolor{stringliteral}{"longshot"}, \textcolor{stringliteral}{"jammer"}, \textcolor{stringliteral}{"crashdown"}, \textcolor{stringliteral}{"hardball"},
      \textcolor{stringliteral}{"duck"}, \textcolor{stringliteral}{"racetrack"}, \textcolor{stringliteral}{"apolo"}, \textcolor{stringliteral}{"husker"}, \textcolor{stringliteral}{"freaker"},
      \textcolor{stringliteral}{"skulls"}, \textcolor{stringliteral}{"bulldog"}, \textcolor{stringliteral}{"flat top"}, \textcolor{stringliteral}{"hammerhead"}, \textcolor{stringliteral}{"gonzo"}
   \};
   \hyperlink{struct__Eina__Array}{Eina\_Array} *array;
   \hyperlink{group__Eina__Array__Group_gaf9af7cd8afa60d6b1cab805bd5b838aa}{Eina\_Array\_Iterator} iterator;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *item;
   \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} i;

   \hyperlink{group__Eina__Main__Group_gabf448ada5bc81a07342b66c6f818ee5e}{eina\_init}();

   array = \hyperlink{group__Eina__Array__Group_ga4a389204db37b44b31d29f581258ac7d}{eina\_array\_new}(10);

   \textcolor{keywordflow}{for} (i = 0; i < 20; i++)
     \hyperlink{group__Eina__Array__Group_gaf2f4a5907f1826354977adbd63e3379a}{eina\_array\_push}(array, strs[i]);

   \hyperlink{group__Eina__Array__Group_ga09564606d36b330d63ec1dde1e96a749}{eina\_array\_clean}(array);
   \textcolor{keywordflow}{for} (i = 0; i < 20; i++)
     \hyperlink{group__Eina__Array__Group_gaf2f4a5907f1826354977adbd63e3379a}{eina\_array\_push}(array, strings[i]);

   \hyperlink{group__Eina__Array__Group_ga466c2d377561b4dde4a4c67988ba32f6}{eina\_array\_data\_set}(array, 17, \textcolor{stringliteral}{"flattop"});

   \hyperlink{group__Eina__Array__Group_gab4171f1665fadbf71ff3f418258e8a31}{eina\_array\_remove}(array, keep, NULL);
   \hyperlink{group__Eina__Array__Group_ga810ed3618ca03f7d549a1bf2c33b2b6e}{EINA\_ARRAY\_ITER\_NEXT}(array, i, item, iterator)
     printf(\textcolor{stringliteral}{"item #%u: %s\(\backslash\)n"}, i, item);

   \hyperlink{group__Eina__Array__Group_ga97995d81ca401d71a2913a52f8b40c41}{eina\_array\_free}(array);

   \hyperlink{group__Eina__Main__Group_ga6741fcaba116e31e96ce14dcfa03f568}{eina\_shutdown}();

   \textcolor{keywordflow}{return} 0;
\}
\end{DoxyCodeInclude}
 