
- Forum
- Programming Talk
- C and C++
- Kindly mention the Cases
Kindly mention the Cases
This is a discussion on Kindly mention the Cases within the C and C++ forums, part of the Programming Talk category; What are the conditions or scenarios under which one may get Segmentation fault in C programming language? If someone could ...
-
Kindly mention the Cases
What are the conditions or scenarios under which one may get Segmentation fault in C programming language? If someone could mention this I will take care while coding my C program.
-
Segmentation fault in occurs mainly when a memory area that is not allowed to be accessed is tried to be used.
For example if you have a C code as below placed in a memory protected platform:
char *a = "Example";
*a = 'T';
Then on compilation of the above program you would get segmentation fault as the Example string was tried to be placed in area of memory marked as read only.

Reply With Quote





