AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: no-it-all — September 16, 2007
    -25 votes
      + -

    Stacks always grow. If a stack is shrinking, you’ve either got a broken machine, or a time machine, in which case you probably also have a cyber-quantum-singularity-trinary-micro-cpu computer from the future, so you wouldn’t really care either way.

  2. Submitted By: whisky — October 8, 2007
    +3 votes
      + -

    Print memory locations from the stack

  3. Submitted By: Gumnam Singh — October 14, 2007
    +6 votes
      + -

    Two possible ways

    - Allocate two local variables and print the addresses of each one to find out where the stack is growing
    ex: func()
    {
    int a;
    int b;
    printf(”0x%x, 0x%x\n”, &a, &b);
    }
    if a has higher memory address than b then stack is growing down else upwards
    - This can be achieved using stack frame.
    int main(…)
    {
    int a;
    printf(”0x%x\n”, &a);
    func();
    }

    void func()
    {
    int b;
    printf(”0x%x\n”, &b);
    }

  4. Submitted By: Krishna Pavan — October 15, 2007
    +18 votes
      + -

    You may do it with only one variable as below
    int main(void) {
    int a;
    if (((int)(&a + 1) - (int)&a)) > 0) {
    /*Stack grows upwards*/
    } else {
    /*Stack grows downwards*/
    }
    return 1;
    }

  5. Submitted By: Devendra khandelwal — December 30, 2007
    -8 votes
      + -

    #include

    int main(void)
    {
    int a;
    if ((((int)(&a + 1) - (int)&a)) > 0)

    {
    printf(”Stack grows upwards”);
    }
    else
    {
    printf(”Stack grows downwards”);
    }
    return 1;
    }

  6. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.