typedef struct {
int top;
int q[10000];
} MyStack;
/** Initialize your data structure here. */
MyStack* myStackCreate() {
MyStack* obj = (MyStack*)calloc(1,sizeof(MyStack));
obj->top=-1;
return obj;
}
/** Push element x onto stack. */
void myStackPush(MyStack* obj, int x) {
obj->q[++obj->top]=x;
}
/** Removes the element on top of the stack and returns that element. */
int myStackPop(MyStack* obj) {
return obj->q[obj->top--];
}
/** Get the top element. */
int myStackTop(MyStack* obj) {
return obj->q[obj->top];
}
/** Returns whether the stack is empty. */
bool myStackEmpty(MyStack* obj) {
return obj->top == -1;
}
void myStackFree(MyStack* obj) {
free(obj);
}