I'm taking baby steps with C after having been spoiled with Python.
Can someone tell me why this gives me "error C2143: syntax error : missing ';' before 'type'"? The line with the error is the line "int num;".
Code:
int main(void)
{
printf("Hello");
int num;
return 0;
}
It's not supposed to do anything in particular of course - I was just wondering why declaring a variable after the "printf" statement like this is a syntax error. Are you always supposed to declare variables right at the start of a function before anything else? If so, why?