Salem_c's Profile User Rating: ****-

Reputation: 2030 Grandmaster
Active Posts:
4,002 (2 per day)
30-May 10
Profile Views:
Last Active:
User is offline Yesterday, 11:21 PM

Previous Fields

Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
Icon   Salem_c Gloom and DOOM!

Posts I've Made

  1. In Topic: Segmentation Fault

    Posted 24 Nov 2015

    Well the usual thing to do is compile the program with debug symbols, then run the code in the debugger.

    When it does segfault, the debugger will catch the fault and point you at the line of code causing the fault.

    From there, you can print variables to decide whether it's an invalid pointer or out of range subscript.

    Knowing these things, you can start to think about a solution.
  2. In Topic: destroying a whole stack

    Posted 24 Nov 2015

    Why is your pop_stack() calling malloc at all?

    Unless you have some bizarre dummy first node, your pop_stack needs to be a pointer

    int pop_stack ( stack_t *s, int *data) {
      if ( !s || !*s ) return -1;
      stack_t *temp = *s;
      *data = (*s)->datum;  // copy out the value
      *s = (*s)->next;  // advance ToS to the next element
      free(temp);  // free the now no longer used element
      return 0;

    FWIW, hiding pointers inside typedef's just makes code more confusing.
  3. In Topic: Reading file into an array 5 integers at a time

    Posted 23 Nov 2015

    Well the ; at the end of line 42 isn't helping.
  4. In Topic: Understanding fstream User and Pass Login

    Posted 22 Nov 2015

    So what do you think while(!userValid) is doing, if it isn't going to cause the whole file to be read?
  5. In Topic: external file- i keep getting a error

    Posted 22 Nov 2015

    You have for loops, while loops and if statements with mis-placed semi-colons.

My Information

Member Title:
void main'ers are DOOMED
Age Unknown
Birthday Unknown
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information