Re: Code fails with Segmentation Fault




Bill Medland wrote:
Vlad Dogaru wrote:

Hello,

I am trying to learn C, especially pointers. The following code
attempts to count the appearences of each word in a text file, but
fails invariably with Segmentation Fault. Please help me out, I've
already tried all my ideas. Also, please do comment on my coding style
or other aspects. Thank you.

First of all use a debugger to find out where the seg fault occurs.

I agree with you here. Above all, learning to use gdb [or similiar
tool] is very valuable. Learn to develop with it on a routine basis as
it will save your behind more often than not.

Tom

.



Relevant Pages

  • Re: Segmentation Fault
    ... > segmentation fault error when I am receiving messages from a message ... segmentation faults on Suns are often caused by pointers that ...
    (comp.unix.programmer)
  • Re: C coding question
    ... Segmentation Fault: 11). ... pointers would be much appreciated. ... The fclose() ... make sure programs written under FreeBSD are bug free. ...
    (freebsd-questions)
  • Re: C coding question
    ... code below works on Linux, but not on FreeBSD (compiles, but gives ... Segmentation Fault: 11). ... pointers would be much appreciated. ... The fclose() acting on ...
    (freebsd-questions)
  • Re: Segmentation fault
    ... Segmentation fault ... opens the first file and create the second. ... > if and> if which don't check the pointers but assign the the NULL pointer. ...
    (comp.lang.c)