Does only declaring a variable reserves a space for it in the program memory? And if not, then please consider the following snippet:
void foo(int bar, int baz){
int a;
char b[4];
}
This code as soon as it enters foo allocates a space in stack and creates an activation record like this:
| baz |
| bar |
| saved PC |
| a |
| b |
So, how does this activation record allocates space for a and b even if they are only declared and not defined?
aandbare defined but not used. Since the program can’t tell whether they were created, the compiler is free to ignore them.