Google News
logo
Embedded C - Interview Questions
What are some common causes for the segmentation fault error in C?
Segmentation fault is a runtime error, which may occur due to some causes (listed below) when the program is running properly. There are some of the cases (causes), when segmentation fault error may occur,
 
* Usages of the dereferenced pointer (i.e. a pointer which may not have a valid address/memory location to point).
* If you are trying to access a memory area which is read-only. In that case, the program may return segmentation fault error.
* It may also occur when you try to free a memory (using a pointer), which is already freed.
* Segmentation fault is the reason to generate stack overflow error in C.
Advertisement