I have the following simplified code:
#include <stdio.h>
int main ()
{
printf("Hello ");
goto Cleanup;
Cleanup:
char *str = "World\n";
printf("%s\n", str);
}
I get an error because a new variable is declared after the label. If I put the content (mainly initialization) after the label in a {} block, compilation succeeds.
I think I understand the reason for the block in case of a switch, but why should it be applicable in case of a label ?
This error is from a gcc compiler