c - initialization fail on struct -


this question has answer here:

i have been trying run before main (no calls yet). says initialization fail. cause?

compiler complains on number of braces, seem ok.

struct contain {    char* a;             int allowed;     struct suit {       struct t {          char* option;          int count;             };        struct inner {          char* option;           int count;             };            }; };  // initialize struct contain _vector = {      .a = "john",     .allowed = 1,     .suit = {                  .t = {                     .option = "on",                     .count = 7                  },                  .inner = {                     .option = "on",                     .count = 7                  }                         } }; 

you need declare member of inner struct types.

struct contain { char* a;          int allowed;  struct suit {        struct t {               char* option;               int count;              } t;         struct inner {               char* option;                int count;              } inner; } suit; }; 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -