请教c语言算法
编写一个算法,在一顺序栈S中插入元素e为新的栈顶元素。函数Push( int *s, int e)
----------------解决方案--------------------------------------------------------
怎么没人回复?
----------------解决方案--------------------------------------------------------
回复:(shuimitian)请教c语言算法
小弟刚接触c语言,水平有限,请各位大哥指教。不胜感激! ----------------解决方案--------------------------------------------------------
编写一个算法,在一顺序栈S中插入元素e为新的栈顶元素。函数
Push( int *s, int e)
好象还少了一个参数,表示栈顶位置top.
如果这个是全局变量的话(或者有这个定义的话)
Push( int *s, int e)
{
s[top++]=e;//如果top是从0开始的话,如果是从-1开始,那就是s[++top]=e;
}
----------------解决方案--------------------------------------------------------