Re: Code fails with Segmentation Fault
- From: "santosh" <santosh.k83@xxxxxxxxx>
- Date: 28 Nov 2006 10:03:34 -0800
Tom St Denis wrote:
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.
It's likely that a beginner is often put off by a complex program like
gdb. A graphical front-end like ddd might alleviate the learning curve.
But for very small programs, such as those you write when you start
learning C, it might be better to mentally "run" the program, rather
than fire up a debugger at a hint of the least problem.
However I agree that as a program gets larger, a debugger becomes
increasingly handy, especially if the code is written by someone else.
.
- Follow-Ups:
- Re: Code fails with Segmentation Fault
- From: David T. Ashley
- Re: Code fails with Segmentation Fault
- From: Tom St Denis
- Re: Code fails with Segmentation Fault
- References:
- Code fails with Segmentation Fault
- From: Vlad Dogaru
- Re: Code fails with Segmentation Fault
- From: Bill Medland
- Re: Code fails with Segmentation Fault
- From: Tom St Denis
- Code fails with Segmentation Fault
- Prev by Date: Re: Macros
- Next by Date: Re: Code fails with Segmentation Fault
- Previous by thread: Re: Code fails with Segmentation Fault
- Next by thread: Re: Code fails with Segmentation Fault
- Index(es):
Relevant Pages
|