舉個例子: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 是用來做什么的呢。謝謝
2 回答

守著星空守著你
TA貢獻1799條經驗 獲得超8個贊
完整的話,你還應該告訴我定義這個函數之前,代碼里有“類似”這樣的一個語句:
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。
添加回答
舉報
0/150
提交
取消