-
Variable Declarations
Please answer only if you're sure about it.. It may be a kind of noobish , but I can't help it :)
When the object code is prepared during compilation,
is
Code:
int a;
//...
int b;
//...
int c;
equivalent to
Where in the first case, declarations aren't in consecutive lines?
I mean, does it make the program's executable smaller/faster in anyway to declare them by the second method?
-
If you are curious, generate the intermediate assembly code of the two versions of the program in question and compare. With what you have given, the result should be exactly the same.
Anyway, the rule of thumb here is to declare variables near first use.