Eina inline array of strings
This example will create an inline array of strings, add some elements and then print them. This example is based on Basic array usage and Eina inline array usage.
We start with some variable declarations and eina initialization:
int
main(int argc, char **argv)
{
const char* strings[] = {
"helo", "hera", "starbuck", "kat", "boomer",
"hotdog", "longshot", "jammer", "crashdown", "hardball",
"duck", "racetrack", "apolo", "husker", "freaker",
"skulls", "bulldog", "flat top", "hammerhead", "gonzo"
};
char **str, **str2;
Eina_Inarray *iarr;
int i;
eina_init();
We then create the array much like we did on Eina inline array usage :
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 char**
to populate our inline array:
The source for this example: eina_inarray_02.c