

This example will create an inline array of strings, add some elements and then print them. This example is based on \hyperlink{eina_array_01_example_page}{Basic array usage} and \hyperlink{eina_inarray_example_01}{Eina inline array usage}.

We start with some variable declarations and eina initialization\-: 
\begin{DoxyCodeInclude}
\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   \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"}
   \};
   \textcolor{keywordtype}{char} **str, **str2;
   Eina\_Inarray *iarr;
   \textcolor{keywordtype}{int} i;

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

\end{DoxyCodeInclude}


We then create the array much like we did on \hyperlink{eina_inarray_example_01}{Eina inline array usage} \-: 
\begin{DoxyCodeInclude}
   iarr = \hyperlink{group__Eina__Inline__Array__Group_ga38a116a1355055b470c31bb4f633e53b}{eina\_inarray\_new}(\textcolor{keyword}{sizeof}(\textcolor{keywordtype}{char} *), 0);

\end{DoxyCodeInclude}


The point were this example significantly differs from the first eina inline array example. We'll not be adding the strings themselves to the array since their size varies, we'll store pointer to the strings instead. We therefore use {\ttfamily char$\ast$$\ast$} to populate our inline array\-: 
\begin{DoxyCodeInclude}

   \textcolor{keywordflow}{for} (i = 0; i < 20; i++)\{
     str = (\textcolor{keywordtype}{char} **)(&strings[i]);
      \hyperlink{group__Eina__Inline__Array__Group_ga6b9a97816b98ccf9be6b65ca06b90013}{eina\_inarray\_push}(iarr, str);
   \}

\end{DoxyCodeInclude}


The source for this example\-: \hyperlink{eina_inarray_02_c}{eina\-\_\-inarray\-\_\-02.\-c} 