"Segmentation fault" is the error message that most POSIX-driven systems (for example, Linux or Unix) will emit when any program attempts to access memory in an invalid manner. This occurs most frequently by attempting to use memory not allocated to the program, although simply running out of memory will, on some systems, produce the same error message. The signal that a program receives, and usually returns as a crash code, is "SIGSEGV".
Although "Segmentation fault" may not seem to be a particularly useful error message, an experienced programmer who has worked with his or her programming language of choice for a sufficient period of time is likely to inform you that "Segmentation fault" is, indeed, a nearly useless error message. It is nearly useless because it can occur for a wide variety of potentially non-obvious reasons. Although "Segmentation fault" always implies a memory error of some form, the number of ways that such an error could occur is far larger than it might first appear. Almost any error that compiles anyway will result in a segmentation fault.
The C++ programming language is notable for its extensive reliance on pointers. While pointers are powerful, they can lead to spaghetti code once too many levels of indirection occur. Should any of the pointers in a computer program become invalid, and are accessed before they are corrected, the result is nearly always a segmentation fault. The other possible outcome is more troubling: fandango on core, in which data corruption within a program occurs due to invalid pointer usage, but the program doesn't wreck anything it's presently using and does not go outside its bound space, so continues running until some time later, when it encounters its own garbage and crashes. The point at which the program crashes may have nothing to do with where the error occurred.
The most popular cause of a segmentation fault, by far, is invalid array indexing. Although some programming languages, such as Java, check for this, C, C++, and many others do not. Array indexing is frequently done internally as pointer arithmetic; the variable that stores the array is nothing more than a pointer to the head of the array, and elements of the array are calculated by adding the array index to the location of the head of the array. Therefore, if an array index runs out of bounds, the program will access memory not allocated to the array as part of the array. If this access attempt runs out of the program's segment, the result will be the familiar error message.
"Segmentation fault" is a very ambiguous message. It does not say where the error occurred or why, although an experienced hacker may be able to pick through the core dump and figure out exactly what failed. Even this, however, may be misleading, if a former error corrupted data later in the program. Receiving a segmentation fault in a very large program is possibly one of the most annoying experiences a programmer can have because the error could have happened nearly anywhere in the code- perhaps even in an included library. The message can mean so many different kinds of errors, no block of code can be eliminated from scrutiny.
Most programmers learning C or C++ for the first time will become very familiar with this message.