int pop() {
if(isEmpty(top))
{
cout << "Stack underflow << endl;
return -1;
}
else
{
Node* n = top;
int x = n->data;
top=top->next;
free(n);
return x;
}
}
#include <iostream> using namespace std; struct Node { int data; Node* next; }; class Stack { Node* top; public: Stac...
No comments:
Post a Comment