Adobe Interview Question
Software Engineer / Developerswrite a simple code having more than 1 automatic variables and print their addresses. If assigned addresses are decreasing, then stack is growing downward, otherwise upward.
#include <stdio.h>
int main()
{
int a=1;
int b=2;
int c=3;
printf("%x %x %x\n", &a, &b, &c);
return 0;
}
In another way,print an automatic variable's address and then call another function and then print address of another newly declared local variable in that function.If the address is increasing,the stack is growin upwards otherwise downwards
- Topcoder March 23, 2011