structStackNode{int data; StackNode *next;StackNode(int a) { data = a; next =NULL; }};structMyStack{ StackNode *top;voidpush(int);intpop();MyStack() { top =NULL; }};//Function to push an integer into the stack.void MyStack ::push(int x){ // Your Code StackNode *p =newStackNode(x);if (!top) { top = p; }else { StackNode *temp =NULL; temp = top; top = p;p->next = temp; }}// Function to remove an item from top of the stack.int MyStack ::pop(){ // Your Codeif (!top) {return-1; }int x =top->data; top =top->next;return x;}