I'm learning C and I am confused about this stuct I came across, but I think maybe it is short hand for simply creating a struct array.
struct myStruct
{
char *name;
int id;
} myList[] = {
{"bob", 1},
{"joe", 2}
};
Is the same as
struct myStruct
{
char *name;
int id;
};
struct myStruct myList[] = {
{"bob", 1},
{"joe", 2}
};
Or am I wrong?
("bob", 1)identical to1? Otherwise, yes, it's equivalent. But don't forget the semicolon after thestructdefinition.gccwith-std=c11flag. This doesn't seem to be standard C.{"bob", 1}, not("bob", 1).