John C. answered 05/12/20
BS and MS in Comp Sci, 34 years experience, 3 yrs CS tutoring
A segmentation fault is essentially an illegal memory access. Illegal memory accesses are usually caused by invalid pointers; e.g., by trying to reference a null pointer or by trying to reference a pointer that points to an object that has been deleted/freed.