定义函数时的status 的用处是什么举个例子:status push(linkstack top,elemtype e){p=(linkstack)malloc(sizeof(snode));//建新结点if(!p) return OVERFLOW;p->data=e;p->next=top->next;top->next=p;//在表的第一元素之前插入新结

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/07 03:04:42
定义函数时的status 的用处是什么举个例子:status push(linkstack top,elemtype e){p=(linkstack)malloc(sizeof(snode));//建新结点if(!p) return OVERFLOW;p->data=e;p->next=top->next;top->next=p;//在表的第一元素之前插入新结

定义函数时的status 的用处是什么举个例子:status push(linkstack top,elemtype e){p=(linkstack)malloc(sizeof(snode));//建新结点if(!p) return OVERFLOW;p->data=e;p->next=top->next;top->next=p;//在表的第一元素之前插入新结
定义函数时的status 的用处是什么
举个例子:
status push(linkstack top,elemtype e)
{
p=(linkstack)malloc(sizeof(snode));//建新结点
if(!p) return OVERFLOW;
p->data=e;
p->next=top->next;
top->next=p;//在表的第一元素之前插入新结点
return OK;
}
这个status 是用来做什么的呢.

定义函数时的status 的用处是什么举个例子:status push(linkstack top,elemtype e){p=(linkstack)malloc(sizeof(snode));//建新结点if(!p) return OVERFLOW;p->data=e;p->next=top->next;top->next=p;//在表的第一元素之前插入新结
完整的话,你还应该告诉我定义这个函数之前,代码里有“类似”这样的一个语句:
typedef int Status; /*类型名定义用status代替int*/
这样你应该理解了吧,status push(linkstack top,elemtype e) 的意思就是:int push(linkstack top,elemtype e),Status只是int的替身.
typedef语句的功能是为现有类型创建一个新的名字.
如果你的代码里有:typedef char Status; 那么这里status push的意思应该是 char push.
如有问题再和我联系.