stack variable

This is a discussion on stack variable within the C Programming forums, part of the General Programming Boards category; my code: Code: struct N { int i; int j; } void test() { N p; int a=0; } main() ...

  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
    University of Waterloo
    Posts
    1,904
    Please restate your question in a more comprehensible manner.

    Thanks for using code tags.

  3. #3
    cwr
    cwr is offline
    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-12-2006, 12:41 AM
  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, 12:05 PM
  5. What am I doing wrong, stack?
    By TeenyTig in forum C Programming
    Replies: 2
    Last Post: 05-27-2002, 03:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21