I\'m taking a class on C, and running into a segmentation fault. From what I understand, seg faults are supposed to occur when you\'re accessing memory that hasn\'t been all
This code runs fine for me under Linux and I can't see anything obviously wrong about it. You can try to debug it via gdb. Compile it like this:
gcc -g -o testcode test.c
and then say
gdb ./testcode
and in gdb say run
If it crashes, say where
and gdb tells you, where the crash occurred. Then you now in which line the error is.