Search:

Type: Posts; User: Norm

Search: Search took 0.08 seconds.

  1. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    If the returned value is a DataElement, then the variable that is assigned what pop() returns must be defined as a DataElement.

    How does the code test the pop() method? Look at the variables used...
  2. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    I think the design is wrong.
    If push() puts a DataElement on the stack
    and peek() shows what's on the top of the stack as a DataElement
    then pop() should return a DataElement

    all three should...
  3. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    push() adds a DataElement object to the stack,
    peek() returns the DataElement that is at the top of the stack
    pop should return a DataElement object from the top of the stack like peek() does

    or...
  4. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    If pop() returns a char, then it needs to get a char from the element it removes from the stack.


    I don't understand why pop() is not the opposite of push() and why peek() is also different. ...
  5. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    If you know where the data exists that pop() is supposed to return, how can pop() get that data?

    To remove the top/first of a linked list, get a pointer to the first node in the list from the...
  6. Replies
    11
    Views
    1,416

    Re: Need help with my POP method!!!

    Comment: should the code save what is returned by the pop() method?

    Where can the pop() method get the data it is supposed to return? How can the pop() method remove the top of the stack so that...
Results 1 to 6 of 6