栈是先进后出

int stk[N],tt;

//插入操作
stk[++ tt] = x;

//弹出操作
tt --

//判断非空
if(tt > 0)
{
   no empty
}
else {
  empty
}

//栈顶
stk[tt];