In C programming, a segmentation fault is a type of error caused if you try to access memory that “does not belong to you.”
When your code tries to perform read and write operation in a read-only location in memory or freed block of memory, this segmentation fault occurs.
Common Segmentation fault scenarios:
- Modifying a string Literal
- Trying to access an address that is freed
- Accessing out of array index bounds
- Improper use of scanf()
- Stack Overflow
- Dereferencing uninitialized pointer
If you want to learn C programming, then check out this C Certification program by Intellipaat.
Also, watch this YouTube tutorial on C programming: