Thread: stack variable

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    7

    stack variable

    my code:

    Code:
    struct N
    {
     int i;
     int j;
    }
    
    void test()
    {
     N p;
    int a=0;
    }
    
    main()
    {
    
      test();
    
    // my question: run to here the variable a and p whether is free? 
    }

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Please restate your question in a more comprehensible manner.

    Thanks for using code tags.

  3. #3
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Yes, I don't understand your question either.

    Also your code is invalid. You need a ; after the closing brace of your struct declaration, and you must make the declaration in test() "struct N p;", not just "N p;" unless you make a typedef.

    Your commented line "my question: run to here the variable a and p whether is free?" is baffling, everything is a valid word or identifier, but it makes no sense.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stack and pointer problem
    By ramaadhitia in forum C Programming
    Replies: 2
    Last Post: 09-11-2006, 11:41 PM
  2. Question about a stack using array of pointers
    By Ricochet in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2003, 10:12 PM
  3. Stack problem
    By silicon in forum C++ Programming
    Replies: 3
    Last Post: 11-11-2003, 04:30 PM
  4. Relocatable code and Symbol Table
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 06-10-2002, 11:05 AM
  5. What am I doing wrong, stack?
    By TeenyTig in forum C Programming
    Replies: 2
    Last Post: 05-27-2002, 02:12 PM