Wednesday, May 5, 2010
What direction is the stack growing?
You are working on a machine / compiler and you want to determine if the stack is growing towards increasing or decreasing addresses. What strategy would you use?
Subscribe to:
Post Comments (Atom)
1 comment:
void func ( const int arg1, const int arg2 )
Reply Delete{
if ( &arg1 > &arg2 ) // args pushed right to left in c
{
cout << "Stack grows up" << endl;
}
else
{
cout << "Stack grows down" << endl;
}
}