鏈棧的初始化,進棧,出棧,以及出棧是相當於單鏈表的刪除,進棧相當於單鏈表的頭插法。

#include  #include  //定義鏈棧 typedef struct Lnode{ int data; struct Lnode *next; }Lnode;  //初始化鏈棧  struct Lnode *init(Lnode *L) { L=(Lnode*)malloc(sizeof(Lnode));   L->next=NULL;  return L; } //進棧 struc
相關文章
相關標籤/搜索