Troubleshooting Segmentation Violations/Faults

A common run-time error for C programs by beginners is a "segmentation violation" or "segmentation fault." When you run your program and the system reports a "segmentation violation," it means your program has attempted to access an area of memory that it is not allowed to access. In other words, it attempted to stomp on memory ground that is beyond the limits that the operating system (e.g., Unix) has allocated for your program.

Any time your program gives a "segmentation violation" or "segmentation fault" error, review this document for tips on correcting the error.

Common causes of this problem: