hi,
when i run my program and put input in, it says segmentation fault and ends my program?? does anyone know why or how to fix this?? Thanks..
Printable View
hi,
when i run my program and put input in, it says segmentation fault and ends my program?? does anyone know why or how to fix this?? Thanks..
you'll need to paste some of your code where you think it is seg-faulting..
I don't think he understands what a segfault is....
compile your program like this:Run it in debugger like gdb to show you where in your code it bombed.Code:cc myprog.c -g -o myprog
Whatever degugger you have go into to help and find the command that does a backtrace or a stack dump. Use that and it will show you where in your code things went South.Code:gdb myprog
gdb> r
................ error messages
gdb> ba
salsa...i'm not for sure what exactly it is, but ussually when i get a segmentation fault it's because i try to dereference a pointer to something that doesn't exist....ussually it's a class....but c doesn't use classes does it?
Essentially, when you run your program the kernel gives you a block of space to use. If you try accessing memory that isn't in that block of space then it will give this error. It's to protect you from bad programs that might try to modify other running programs or data in memory.Code:SIGSEGV 11 Core Invalid memory reference