Whether following structure declaration is right.
typedef struct {
int roll;
int age ;
} class[10];
When I do like this , compiler does not say any error.
But, when I assign class[0].age=10,
am getting error. So here class[0] struct variable or structure name..
Thanks
You are defining a type
classwhich is an array of ten structs. To use this type you have to instatiate a variable of that type:Maybe a slightly cleaner way would be to have two separate typedefs: