Instantiate a local variable in main function(caller) and instantiate another local variable in callee function. Compare both the addresses. If address of local variable declared in main in less than the address of local variable in function(callee) then the stack is growing towards higher address.
Here is the Program which does this:
int main()
{
int localinmain;
CheckStackGrowth(&localinmain);
}
void CheckStackGrowth(int *localinmain)
{
int localinfunction;
if(localinmain < &localinfunction)
printf("Stack is growing downwards.\n");
else
printf("Stack is growing upwards.\n");
}
Categories
FollowersBlog Archive
Jobs
Find more freelance jobs
|
Saturday, November 10, 2007
Subscribe to:
Post Comments (Atom)
|
Popular Posts
|
No comments:
Post a Comment