[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: segmentation fault
kamesh jayachandran wrote:
> Hai lip,
> I am getting segmentation fault while running the following quicksort program.
> My queries are
> 1)what is segmentation fault?
Your program tried to access memory that was NULL or beyond your address space. So
the strict metron Ms. Kernel decided to punish this naughty student by terminating
it's life. However for parents, she decided to send the last(in memory)
photograph. That's what you call core.
In essence core is photocopy of program address space when it got terminated. Now
you find it, why it terminated, by doing a post mortem.
My advice, hunt down every pointer. No other way(usually) segfault happens.
> 2)Will it always lead to dumping of core
Not necessary. I have received segfault without core. But I don't remember how?
> I hereby paste the program throwing segmentation fault
> //program starts here
> void quicksort(int ,int,int);
> int partition(int ,int,int);
Straight from Tanubaum!!. Good Way to learn....