I have this piece of code and i don\'t know how it works
#include
int main(void)
{
int numero = ({const int i = 10; i+10;});
printf
It's a GCC statement expression. It executes the statements in it, and returns the value evaluated in the last statement. Thus numero
is initialized to 20
. If you delete the second part, there is no expression as the last statement, so it can't get a value from the statement expression.
The braces are necessary to disambiguate it from ordinary C parenthesized expressions.