I am writing a program in C that plays crazy 8s with a user. I ran debugger and I got the message "An Access Violation(Segmentation Fault) raised in your program." What does this mean? How can I fix it?
Help with C programming?
The main cause of this error is that you dereferenced an invalid pointer. An example might be using a pointer that you did not initialize, also might have overwrote memory which wasn't sufficiently allocated.
Check your pointer's throughout the program and make sure they are correctly initialized and not considered a "dangling pointer".
Reply:I assume you're working in some *nix environment, right? Do you have gdb available (GNU debugger)? If so, here's how to use it:
gdb 'program name'
run %26lt;insert arguments here%26gt;
When it crashes in gdb, just type 'where', it will tell you what line the program is crashing in and the file where it crashed.
Oh, also, make sure you compile with debug information.
Reply:Segmentation Fault is most likely to occur in case
of wrong use of memory space in ram...
or u r nt getting the required amount of memory...
check for memory leaks...
it will help u out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment