SIGSEGV, segmentation fault

This is a discussion on SIGSEGV, segmentation fault within the C++ Programming forums, part of the General Programming Boards category; I am coding a DOS console application. When I compile and run the program it gets halfway through before quitting ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    7

    SIGSEGV, segmentation fault

    I am coding a DOS console application. When I compile and run the program it gets halfway through before quitting out. It quits out when trying to invoke a function. When I deug the program it says : "Program received signal SIGSEGV, Segmentation fault"

    Does anyone know how I would go about fixing this? Is it a compiler error or a mistake I made. If it helps I am using Dev C++. Any help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    194
    It is probably a code problem. Are you using new/delete or malloc/free?
    Could you post your code, and tell us the function that is causing you problems.

    btw nice username, you a sabres fan?

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    7
    Yeah its probably the code, im still fairly new to this. Its 250 lines long so I posted the code here http://www.sfm-clan.0catch.com/triviagame.txt instead on the mb. The fault (what exactly is a sigsegv, segmentation fault nyways?) seems to occur as soon as it gets to function check. At first I thought it was the random number generator I downloaded but it seems to get past that alright.

    Again thanks for any help

    and

    btw nice username, you a sabres fan?
    Thanks, as a matter of fact I am.
    Last edited by StuBarnes4Prez; 01-04-2002 at 08:24 PM.

  4. #4
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    I'm not sure if this is the only problem because I haven't got the libraries you've used, but you need to change the order of your arrays declarations; i.e. char question[50][80].

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    7
    I fixed that, but that wasn't the reason it was quitting out. Thanks anyways though.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SIGSEGV, Segmentation fault
    By micmac700 in forum C Programming
    Replies: 3
    Last Post: 12-13-2006, 02:47 PM
  2. Segmentation fault
    By NoUse in forum C Programming
    Replies: 4
    Last Post: 03-26-2005, 02:29 PM
  3. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 12:33 PM
  4. Segmentation fault...
    By alvifarooq in forum C++ Programming
    Replies: 14
    Last Post: 09-26-2004, 12:53 PM
  5. debugging: sigsegv, segmentation fault???
    By Gonzo in forum C Programming
    Replies: 9
    Last Post: 09-16-2003, 06:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21