#include <stdlib.h> #include <stdio.h> typedef int Item; typedef struct STACKnode* link; struct STACKnode {Item item;link next;}; static link head; link NEW(Item item,link next) { link x=malloc(sizeof *x); x->item=item;x->next=next; return x; } void STACKinit(int maxN){ head=NULL; } int STACKempty(){ return head==NULL; } STATCKpush(Item item){ head=NEW(item,head); } Item STACKpop(){ Item item=head->item; link t=head->next; free(head); head=t; return item; } int main(){ printf("this is a stack\n"); }
下堆栈的helloworld
猜你喜欢
转载自haoningabc.iteye.com/blog/1847934
今日推荐
周排行