Interview Question

What is segmentation fault?

SIGSEGV is a platform response often triggered by undefined invalid memory access.

💡 Concept ✅ Quick Revision ⚙ C

Answer

A segmentation fault is a platform signal or failure commonly caused by an invalid memory access; it is not an ISO C language term. • On POSIX systems, invalid memory access can generate SIGSEGV. • The C standard usually describes the underlying bad operation as undefined behavior. • Debug the first invalid access rather than relying on the signal as portable behavior.

💡 C Example

int *pointer = NULL; /* Dereferencing pointer here would have undefined behavior. */

⚡ Quick Revision

SIGSEGV is a platform response often triggered by undefined invalid memory access.