the processor, this may result in a segmentation fault. char s[] = "hello world"; char c = s[20]; Stack overflow Another example is recursion without a base case: int main(void) { return main(); } which causes the stack to overflow which results in a segmentation fault. Infinite recursion may not necessarily result in a stack overflow depending on the language, optimizations performed by the compiler and the exact structure of a code. In this case, the behavior of unreachable code (the return statement) is undefined, so the compiler can eliminate it and use a tail call optimization that might result in no stack usage. Other optimizations could include translating the recursion into iteration, which given the structure of the example function would result in the program running forever, while probably not overflowing its stack. See also General protection fault Storage violation Guru Meditation References External links Process: focus boundary and segmentation fault A FAQ: User contributed answers regarding the definition of a segmentation fault A "null pointer" explained Answer to: NULL is guaranteed to be 0, but the null pointer is not? The Open Group Base Specifications Issue 6 signal.h Articles with example C code Computer errors Memory management