0

Delete items>0

#include<iostream> using namespace std; struct Stack { int data; Stack *head; Stack *next; }; void push(int x, Stack *myStk) { Stack* e = new Stack; e->data = x; e->next = myStk->head; myStk->head = e; } int pop(Stack *myStk) { if (myStk->head == NULL) { cout « "stack is empty!" « endl; return -1; } else { Stack *e = myStk->head; int a = myStk->head->data; myStk->head = myStk->head->next; delete e; return a; } } ........................

1st Apr 2018, 9:20 AM
Vitos
1 ответ
+ 1
What's the question?
1st Apr 2018, 10:40 AM
Emma