what is segmentation fault?

Answer Posted / vinaymb

Consider an example

#include "stdio.h"
main ()
{
char *ptr = "BANGLAORE";
*ptr = "b";
}

This Program will compile without any error. But on running
this program you will get the Segmentation error. Because
the ptr will hold the address which is read-only and we are
changing the value at the read-only which will result in
segmentation fault.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are different ways the context switch happens from user to kernel space or vice-versa ?

2131


What are system calls used for process management in linux?

577


I would like to know whether Simado and Setu products are they EPBX or not ?

1922


Explain process management system calls in linux?

536