Discussion:
Segmentation fault with ex1
(too old to reply)
Hammad Imad
2004-02-08 05:16:12 UTC
Permalink
When i run ex1 i get a segementation fault but my program works fine
with ex2,ex3 and ex4.
i cant see any differnce between ex1 and ex2, can someone tell me why
this happeneing?


Thank you
Alexander Smith
2004-02-08 18:48:43 UTC
Permalink
ex1.cnf is the only file where the number of variables is larger than the
number of clauses. Maybe you're reading them in the wrong order? In
general, if you've got a seg fault, you should run your program through
gdb. It will tell you exactly where it's happening, and you can examine
the values of variables, etc. to see what's going on.

Use gdb! It will help! In the lab sessions I've seen lots of students who
have spent hours trying to figure out why their programs aren't working,
when a few minutes with gdb can often show you exactly what's going wrong.
Or, if you really can't stand using a text-mode debugger, you can also use
"ddd" in the labs (which is a graphical interface to gdb), or go to one
of the ECF-PC labs running Windows and use MS VisualC++ which has a nice
graphical debugger. (But make sure your program eventually works on the
ECF-Linux machines p##.ecf.)

Alexander
Post by Hammad Imad
When i run ex1 i get a segementation fault but my program works fine
with ex2,ex3 and ex4.
i cant see any differnce between ex1 and ex2, can someone tell me why
this happeneing?
Thank you
Loading...