Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6726623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:56:56+00:00 2026-05-26T09:56:56+00:00

I’ve got a bizarre error here: 882 Segmentation fault ./a.out The segment of code:

  • 0

I’ve got a bizarre error here: 882 Segmentation fault ./a.out

The segment of code:

int end=array.Length, loop=0;
cout<<end<<" about to print";
for(;loop<end;loop++){
    cout<<"\nMr. loop says: ";
    array.get(loop).print(fout);
}

Output of my program:

enpty initializer called for llist
enpty initializer called for entry
adding
adding
999deleting999
done deleting
123deleting123
done deleting
333deleting333
done deleting
printing
2 about to print
./g+: line 7:   882 Segmentation fault      ./a.out

and vital output of:

printing
2 about to print
./g+: line 7:   882 Segmentation fault      ./a.out

meaning that the error is this line:

for(;loop<end;loop++){

which has proven good values and is syntactically correct (yes I know its bad style, though).

Ideas? No one at my university seems to be able to help me with this.

here are the files:

  • core.cpp
  • entry.h
  • in.data
  • llist.h
  • mmm.h
  • student.h
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:56:56+00:00Added an answer on May 26, 2026 at 9:56 am

    Unless you’re doing low-level memory operations (and you’re not doing this in the posted program), a segmentation fault is a sign of memory corruption, i.e. you’ve messed up some coding. Note that the memory corruption typically occurs before the error is triggered. In extreme cases, initial memory corruption and actual segmentation fault can be hours and modules apart.

    Your first step should be to run the program in valgrind or gdb to find out the details of the segmentation fault. Also, always compile with at least gcc -Wall and take note of every warning – unless you’re modifying the compiler, changes are every single warning indicates a bug.

    In your case, the error is almost certainly in the implementation of llist. There is a number of problems with that implementation:

    • Implementations don’t belong in .h files, they should be in .cpp files.
    • entry.towardsback and entry.towardsfront are usually called prev(ious) and next – those names are shorter and easier to distinguish.
    • hold should probably be called head, in accordance with the general naming conventions of linked lists.
    • A list of length 0 shouldn’t have any entries, i.e. be initialized with hold == NULL.
    • From line 61 (in add):
    hold->towardsback = node;
    hold->towardsback->towardshead = node; // node->towardshead = node;
    

    The second line is almost certainly wrong. You probably want to configure node first and then just set hold->towardsback = node;.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I would like to count the length of a string with PHP. The string
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
i got an object with contents of html markup in it, for example: string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.