----------------This function prints all the element sof the Stack----------*/
| 83 | |
| 84 | /*----------------This function prints all the element sof the Stack----------*/ |
| 85 | void display(STACK* stack){ |
| 86 | int* a = NULL; |
| 87 | if(!stack) |
| 88 | cout << "Stack Underflow" << endl; |
| 89 | else |
| 90 | cout << "The stack elements are : " << endl; |
| 91 | STACK_NODE* temp = stack -> top; |
| 92 | while(temp -> link != NULL){ |
| 93 | a = (int*)(temp -> dataPtr); |
| 94 | cout << *a << " ---> "; |
| 95 | temp = temp -> link; |
| 96 | } |
| 97 | a = (int*)(temp -> dataPtr); |
| 98 | cout << *a << endl; |
| 99 | } |
| 100 | |
| 101 | int main(){ |
| 102 | int* dataPtr; |