Possible Duplicates:
stack growth direction
Does stack grow upward or downward?
Hi all,
How would I find out if a machine’s stack grows up or down in memory in C. More importantly, which is better: a system in which the stack grows up or one in which a stack grows down ?
And will below logic work ???
void sub(int *a)
{
int b;
if (&b > a) {
printf("Stack grows up.");
}
else
{
printf("Stack grows down.");
}
}
main ()
{
int a;
sub(&a);
}
I mean this expression is valid in C
if (&b > a)