The difference is that the second is invalid.
The material between {and }in the structure declaration is a sequence of member declarations. Your
struct myinnerstruct
{
int y;
};
- type declaration; he does not declare a member of the closing structure, so in this context he is illegal.
What you can do is:
struct mystruct
{
int x;
struct myinnerstruct
{
int y;
} m;
};
m , ; struct myinnerstruct. , , . struct myinnerstruct struct mystruct; . .
, struct myinnerstruct - , :
struct mystruct
{
int x;
struct
{
int y;
} m;
};
y struct mystruct.
, struct innerstruct , , .
, struct innerstruct .
C99 standard ( PDF), 6.2.1, 2, :
, , (.. ) . , . : , , . ( - , .)
C90 C11 , , .
{ } - , , , ; - . , struct myinnerstruct , . , , , ; . , .