编辑代码
C++代码
gcc13.2
gcc7.5.0
clang-10
运行
//元素elem进栈,a为数组,top值为当前栈的栈顶位置
int
push
(
int
*a,
int
top,
int
elem)
{ a[++top]=elem;
return
top; }