What does the error Segmentation fault (or violation) mean?
A segmentation fault occurs when a program requests a location in memory that is outside the program’s reserved space. Most incidences of segmentation violation is caused by going outside of an array bound. The quickest way to find this error is probably to compile the program using the ‘-g’ option, then run the program with dbx and use the ‘where’ command when the segmentation violation occurs. You should be pointing at or within a line or two of the offending command.