It's probably giving a segmentation fault because you're trying to print a variable
that hasn't been initialized properly (that isn't defined).
In doing so, it accesses (accidentally) a piece of memory that belongs to a different program,
causing the segmentation fault.
Simply said, check the code. See what gets printed and check if it is always defined (always has a value).
I don't have the Richard Stevens book, so I can't really help you any further.
|