Thread: Testing some code, lots of errors...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Sparrowhawk
    Doing this and what the poster above you solves the previous errors but causes about 20 more...
    You need to understand pointer syntax. What you want is to declare and define these functions:
    Code:
    double pop (double stack[], int *stackSize);
    void push (double stack[], int *stackSize, double x);
    You would use them like this:
    Code:
    push(stack, &stackSize, 9.0);
    pop(stack, &stackSize);
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    98
    Quote Originally Posted by laserlight View Post
    You need to understand pointer syntax. What you want is to declare and define these functions:
    Code:
    double pop (double stack[], int *stackSize);
    void push (double stack[], int *stackSize, double x);
    You would use them like this:
    Code:
    push(stack, &stackSize, 9.0);
    pop(stack, &stackSize);
    Changed, still the exact same list of errors posted above.

    Too be honest, I started out using pointers but I got some errors there and tried to switch it around... But so far I've just been getting more and more errors... There's something simpler that's causing a bunch of errors to happen...

  3. #3
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    Quote Originally Posted by Sparrowhawk View Post
    Changed, still the exact same list of errors posted above.

    Too be honest, I started out using pointers but I got some errors there and tried to switch it around... But so far I've just been getting more and more errors... There's something simpler that's causing a bunch of errors to happen...
    Please post your most recent code as such.
    Not everything that can be counted counts, and not everything that counts can be counted
    - Albert Einstein.


    No programming language is perfect. There is not even a single best language; there are only languages well suited or perhaps poorly suited for particular purposes.
    - Herbert Mayer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. set testing code
    By zxcv in forum C++ Programming
    Replies: 8
    Last Post: 12-22-2008, 02:58 AM
  2. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  4. linked list source code errors
    By C++_Learner in forum C++ Programming
    Replies: 1
    Last Post: 04-18-2002, 11:04 PM
  5. Reqd. C source code for Testing purposes
    By DP in forum C Programming
    Replies: 5
    Last Post: 01-14-2002, 12:45 PM