Frodo Baggins wrote:
Please don't top post. Your reply belongs *under* the text you are
replying to.
This is a bit off the track the rest of the ppl in this thread are on.
Please don't use contractions like ppl, they make your post harder to
read for no good reason.
However I think this is useful.
For any case of "Segmentation fault" , compile the prog with (in gcc)
with
-Wall (enables all warnings) and -g (generates debug info) switches
enabled.
<OT>
You should also use "-ansi -pedantic -O" with gcc and some people
recommend -W as well.
<OT>
There are GNU mailing lists where you can get more help on this
including the reason for adding -O.
However, there was no indication in what you quoted that the OP was
using gcc. I've used a number of other compilers under systems that can
produce a "segmentation fault".
Then run the executable under gdb.
That usually pinpoints the source of the segFault.
This only works some of the time, undefined behaviour can often lead to
a crash a long way down the line such as when freeing memory.
You should also redirect people to other groups when you start
discussing the specifics of particular systems since they are not on
topic here beyond the odd example to illustrate a point.