segmentation fault

This is a discussion on segmentation fault within the C++ Programming forums, part of the General Programming Boards category; Yes, another question with hopefully an easy solution. I keep getting a segmentation fault error in g++ when I try ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    81

    segmentation fault

    Yes, another question with hopefully an easy solution.
    I keep getting a segmentation fault error in g++ when I try to run a.out.. I get some different errors in Visual c++ though. The main program isn't the problem, it is the included header.

    Please take a look at what I have and tell me what you think. Thanks.

    file included:
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2003
    Posts
    28
    1. In your overloaded << operator do a "return out;"

    2. In the function List::replace(VALUE_TYPE v), you are declaring a variable VALUE_TYPE x. Without initializing it to anything you are trying to use it as array index...... hence segmentation fault...

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    81
    Thank you for your help. That helped out a whole lot!

    My code for calculating the data is still incorrect though. I need to fix that somehow.

    If anyone can show me also, how to impliment another class called Stack ontop of that, that would be fantastic!

    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Segmentation fault problem
    By odedbobi in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2008, 02:36 AM
  2. Segmentation fault
    By bennyandthejets in forum C++ Programming
    Replies: 7
    Last Post: 09-07-2005, 05:04 PM
  3. Segmentation fault
    By NoUse in forum C Programming
    Replies: 4
    Last Post: 03-26-2005, 02:29 PM
  4. Locating A Segmentation Fault
    By Stack Overflow in forum C Programming
    Replies: 12
    Last Post: 12-14-2004, 12:33 PM
  5. Segmentation fault...
    By alvifarooq in forum C++ Programming
    Replies: 14
    Last Post: 09-26-2004, 12:53 PM

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