What is segfault?

It occurs when a program attempts to access a memory location it is NOT allowed to access.

Examples

Trying to write to READ-ONLY parts of the system

Trying to dereference a null pointer. Trying to dereference an uninitialized pointer, which points to a random memory address. Trying to dereference a freed pointer, which points to freed/dealloc/del mem.