A
amit.codename13
in the statement
int a=1,2;
i get the following error with a gcc compiler
/home/amit/main.c||In function ‘main’:|
/home/amit/main.c|6|error: expected identifier or ‘(’ before numeric
constant|
||=== Build finished: 1 errors, 0 warnings ===|
the error suggests that either we put a identifier after the comma :
int a=1,b;
or we put a '(' before numeric constant :
int a=(1,2);
so one makes comma act as a initializer list separator and the other
makes it act as a comma operator...
so what may be actual reason for generation of the error...
does it violate the constraints in the syntax of a comma operator or
in the syntax of declarations...
how does the standard deals with symbols with different meanings in
different contexts
int a=1,2;
i get the following error with a gcc compiler
/home/amit/main.c||In function ‘main’:|
/home/amit/main.c|6|error: expected identifier or ‘(’ before numeric
constant|
||=== Build finished: 1 errors, 0 warnings ===|
the error suggests that either we put a identifier after the comma :
int a=1,b;
or we put a '(' before numeric constant :
int a=(1,2);
so one makes comma act as a initializer list separator and the other
makes it act as a comma operator...
so what may be actual reason for generation of the error...
does it violate the constraints in the syntax of a comma operator or
in the syntax of declarations...
how does the standard deals with symbols with different meanings in
different contexts