title: How to return bottom element of stack in C++?
body: <p>I'm trying to add an additional method to my 'stack' class that will return the bottom element in the stack. However.. I'm just having trouble wrapping my head around this one. This is the code I have so far in my stack.cpp, but it's not working correctly:</p>
  
  <pre><code>bool Stack::bot(StackItemType&amp; stackBottom){
    if (isEmpty()) return false;
  
    StackItems *temp = top;
    while (temp != NULL) {
      temp = temp-&gt;below;
    }
  
    stackBottom = temp-&gt;item;
    return true;
  } // end bottom
  </code></pre>
  
  <p>Any help ? Thank you.</p>