what is segmentation fault?

Answer Posted / vijaya aliveni.m

The physical memory in a computer is managed by the
operating system.It has different segments for different
purposes.
Here is an example of ANSI C code that should create a
segmentation fault on platforms with memory protection:

int main(void)
{
char *s = "hello world";
*s = 'H';
}

In the above ex. string "s" will hold the "hello world".
But in bellow we are trying to replace the letter "H" in the
place of "h".
But in that, pointer is only readonly we are not able to
change the charters.
So , while executing it will show the segmentation fault.

Is This Answer Correct ?    8 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are system calls used for process management in linux?

577


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

2131


Explain process management system calls in linux?

536


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

1923