I need help with a simple c
structure and can't find it why it's not compiling using gcc
(opensuse 11.4)
I have this code:
struct Image {
int w;
int h;
// other code
};
in the same file I have another struct array like this:
struct ShapeImage
{
Image image[10];
// other code
};
when I compile I get:
syntax error before [' token`
Why I am getting this error if is specify the number 10 in the image
the image[10];
looks good to me, what is wrong?
It should be:
struct Image image[10] ;
Or use typedef while defining the struct:
typedef struct {
int w;
int h;
// other code
} Image;
And use the code otherwise same as in your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With