Thread: Structures...

  1. #1
    Registered User
    Join Date
    Nov 2010


    The schema of the program is

    typedef xxx{
    int www(){
    yyy z;
    now I have another function called aaa. How can I use z again in aaa function without the help of the global variable.

  2. #2
    Registered User
    Join Date
    May 2010
    Pass z as a parameter into aaa.


  3. #3
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    London, United Kingdom
    An even better way would be to pass a pointer to aaa. (i.e. call aaa on the address of z)
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with Nested Structures and Arrays of Structures
    By Ignoramus in forum C Programming
    Replies: 4
    Last Post: 03-02-2010, 01:24 AM
  2. Structures and dynamically allocated arrays
    By Bandizzle in forum C Programming
    Replies: 7
    Last Post: 10-04-2009, 02:05 PM
  3. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  4. Input output with structures
    By barim in forum C Programming
    Replies: 10
    Last Post: 04-27-2004, 08:00 PM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM