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