Give the algorithms for pop and push operations on stack翻译:给出栈上弹出和推送操作的算法
堆栈就是一种先进后出的数据结构最简单的用数组定义一个堆栈
int arr[100]; int top = 0; int pop() { if (top > 0) return arr[top--]; return -1; } void push(int n) { if (top < 100) arr[top++] = n; }