I need this function to return the value in the 'current' location, then decrement the current value.
My question is, how do I return, but then still decrement after that return in the same function? Is it possible?
Current code:
Code:
int Stack::pop()
{
if(current == 0)
return 0;
else
{
list.DeleteItem(current);
current--;
return list.GetItem(current);
}
}
What I need it to do:
Code:
int Stack::pop()
{
if(current == 0)
return 0;
else
{
Delete the Current Value
Return the value being Deleted
Decrement Current
//return list.DeleteItem(current);
// current--;
//But this won't work b/c it decrements after return?!
}
}