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
Post a Comment