int isFull(Node* top) {
Node* p = new(nothrow) Node; // Safe allocation prevents bad_alloc, include new
if(!p) {
return 1;
} else {
delete p;
return 0;
}
}
#include <iostream> using namespace std; struct Node { int data; Node* next; }; class Stack { Node* top; public: Stac...
No comments:
Post a Comment