The schema of the program is
now I have another function called aaa. How can I use z again in aaa function without the help of the global variable.Code:typedef xxx{ ... ...}yyy; int www(){ yyy z; }
The schema of the program is
now I have another function called aaa. How can I use z again in aaa function without the help of the global variable.Code:typedef xxx{ ... ...}yyy; int www(){ yyy z; }
Pass z as a parameter into aaa.
Jim
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.