title: Printing stack with linked list without struct
body: <p>I'm trying to create a stack using linked lists in c++ without struct.Bot i can't wirte display function  how can i display ?Any help or clarification is much appreciated. Thanks </p>
  
  <pre><code>    class StackNode { 
  public: 
      int data; 
      StackNode* next; 
  }; 
  
  StackNode* newNode(int data) 
  { 
      StackNode* stackNode = new StackNode(); 
      stackNode-&gt;data = data; 
      stackNode-&gt;next = NULL; 
      return stackNode; 
  } 
  
  int isEmpty(StackNode* root) 
  { 
      return !root; 
  } 
  
  void push(StackNode** root, int data) 
  { 
      StackNode* stackNode = newNode(data); 
      stackNode-&gt;next = *root; 
      *root = stackNode; 
      cout &lt;&lt; data &lt;&lt; " pushed to stack\n"; 
  } 
  
  
  int peek(StackNode* root) 
  { 
      if (isEmpty(root)) 
          return INT_MIN; 
      return root-&gt;data; 
  } 
  
  
  </code></pre>