Q
quadraticformula
Hey, quick question for anyone willing to listen.
I've always wondered why I can initialize an array of structs with
something like this (where "..." represents the 14 separate values for
the individual DIALOG struct) and it wll compile perfectly:
DIALOG darray[] = { {...}, {...}, {...}, {...}, {...} };
but something like this gives a syntax error (specifically: expected
primary-expression before '{' token):
DIALOG darray[5];
dialog = { {...}, {...}, {...}, {...}, {...} };
If I use a DIALOG darray[5] declaration (like if I wanted to declare
it globally) I always have to dereference every DIALOG in the array
(0-4) and then assign each of the 14 values for the DIALOG struct
individually, which is a major drag. I would much rather use a
bracketed list like in the first example, only I need "darray" to be
global.
Can someone please explain what the difference is and why the latter
is incorrect? Or, if you need more specific information, just let me
know.
Thanks in advance,
keeg
I've always wondered why I can initialize an array of structs with
something like this (where "..." represents the 14 separate values for
the individual DIALOG struct) and it wll compile perfectly:
DIALOG darray[] = { {...}, {...}, {...}, {...}, {...} };
but something like this gives a syntax error (specifically: expected
primary-expression before '{' token):
DIALOG darray[5];
dialog = { {...}, {...}, {...}, {...}, {...} };
If I use a DIALOG darray[5] declaration (like if I wanted to declare
it globally) I always have to dereference every DIALOG in the array
(0-4) and then assign each of the 14 values for the DIALOG struct
individually, which is a major drag. I would much rather use a
bracketed list like in the first example, only I need "darray" to be
global.
Can someone please explain what the difference is and why the latter
is incorrect? Or, if you need more specific information, just let me
know.
Thanks in advance,
keeg