Rajesh S R wrote:
Can anyone explain the validity/invalidity of the following code as
per the C standards?
I'm assuming you know they're invalid, so I'll just list the
constraints they violate.
struct node
{
int a;
float;/*Declarator without any identifier*/
^ [1]
struct node2;/*a struct tag declaration*/
^ [1] + [2]
struct node* ptr;
};
int main( void )
{
int a, b;
double;/*A declarator without any identifier*/
^ [3]
char;/*A declarator without any identifier*/
^ [3]
}
Thanks in advance for the reply.
[1] Syntax error: the declarator may be omitted only in bit-fields
(6.7.2.1)
[2] "A structure or union shall not contain a member with incomplete
or function type" (6.7.2.1)
[3] "A declaration shall declare at least a declarator (other than the
parameters of a function or the members of a structure or union), a
tag, or the members of an enumeration." (6.7)