I'm preparing for a job interview.
My c program is :
void foo(void)
{
int a;
printf("%d\n",a);
}
void bar(void)
{
int a=42;
}
void main(void)
{
bar();
foo();
}
I'm getting the output as : 42
But how? I thought it would be some garbage value .
How the concept of execution stack or activation frame is applied in this?
Please explain
Thanks