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...
Type: Posts; User: Norm
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...
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...
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...
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. ...
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...
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...