struct & global variable

John S. Fine
Sat Sep 26 13:54:00 GMT 2009

Reducing the problem to the point that you can post a complete program 
source (as Andrew told you) is always better.

But even when you are posting just parts of the source, you could do a 
much better job of selecting the relevant parts.

The core of the failure seems to be failure to use in func2 the same 
pointer that was written to ptr in filling_node.  But you have given no 
hint of how that is supposed to work, so how could we guess why it doesn't.

Is it supposed to happen directly through ptr?  If so, you declared ptr 
globally.  Where is the declaration of ptr and what does it look like?

Is it supposed to happen indirectly through start or last?  Where is the 
code that inserts the newly allocated node into the linked list?

The failure is in some code in func2 that tries to access that same 
struct pointer and print contents from the struct, so most importantly, 
post the code that does those two things?

Mohsen Pahlevanzadeh wrote:
> My printf that doesn't print anything is called in func2 that i don't 
> remember i wrote in previous email.
> Quoting Mohsen Pahlevanzadeh <>:

More information about the Gcc-help mailing list