Below logic should tell us about the Machine Stack. let me know in
case I am missing something.

void check_for_stack(int a, int b)
{
  unsigned int addr_1, addr_2;
  printf("%u %u\n", &a, &b);
  printf("0x%x 0x%x\n", &a, &b);
  if(&a > &b)
  {
    printf("Machine Stack grows UP: Address keep decreasing");
  }
  else
  {
    printf("Machine stack grows down: Address Keep increasing");
  }
}
main()
{
  int a,b;
  check_for_stack(a, b);
}
http://codepad.org/XGAbghDz



On Tue, Dec 14, 2010 at 11:02 AM, bittu <[email protected]> wrote:

> How would you find out if a machine’s stack grows up or down in
> memory?
> can any one xplain wid program..
>
>
> Regards
> Shashank Mani
> BIT Mesra
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to