Hello, i study about stacks, and i want to know if Node *old top = top node; is the same as Node *old top = *top node;
if not whats the difference. My code is
1 2 3 4 5 6 7 8 9 10 11
Error code Stack :: pop( )
/* Post: The top of the Stack is removed. If the Stack is empty the method returns
underow; otherwise it returns success. */
{
{
Node *old top = top node;
if (top node == NULL) return underow;
top node = old top->next;
delete old top;
return success;
}
For those that may didn`t understand i give another example
Can i say
The thing you need here is old_top = top_node, but I'll explain all cases:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Type object1 = object2;//copy of an object
object1 = object2;//same without declaration
Type* pointer = &object;//address of object is assigned to pointer
pointer = &object;//same without declaration
Type* pointer1 = pointer2;//copy of an address
pointer1 = pointer2;//same without declaration
Type object = *pointer;//the value to which pointer points, is copied to object
object = *pointer;//same without declaration
*pointer = object;//the value to which pointer points becomes a copy of object. address doesn't change
*pointer1 = *pointer2;//the value to which pointer1 points becomes a copy of
//the value to which pointer2 points. addresses don't change