Array in C struct

I want to have two arrays in a struct, which are initialized at start but need editing further on. I need three instances of the struct, so that I can index into a specific struct and modify as I wish. Is it possible?

This is what I thought I could do but I get errors:

struct potNumber{
    int array[20] = {[0 ... 19] = 10};
    char *theName[] = {"Half-and-Half", "Almond", "Rasberry", "Vanilla", …};
} aPot[3];

Then I access the structs as follows:

 printf("some statement %s", aPot[0].array[0]);
 aPot[0].theName[3];
 …
14
задан Palec 15 March 2015 в 16:54
поделиться