I was looking at the C grammer on K&R and i found this:
compound-statement:
{ declaration-list opt statement-list opt }
declaration-list:
declaration
declaration-list declaration
statement-list:
statement
statement-list statement
Which means that we can't have declarations after statements. However i am doing this really often like:
#include <stdio.h>
int main()
{
printf("Lets use a new block");
{
int a=1;
printf("%d",a);
int b=3;
printf("%d",b);
}
return 0;
}
This code compiles with no warning and no errors. Am i not understanding the grammar correctly?