What does a statement such as this mean ?
int x = ( { int a; scanf( "%d", &a ); a ; } ) ;
It compiles and runs equivalent to :
int x;
scanf( "%d", &x );
It seems to be like some kind of anonymous function call or something, but I'm not sure. I have not come across statements like ({})
before, and I am unable to find any explanations online. Any help would be very much appreciated, thank you :)
Context:
This is the code that you get when the macros in the following code are expanded :
#define SI ({int a;scanf("%d",&a);a;});
int x = SI;
This is the code used by someone in a programming competition.