Implementing a Stack using Link Representation
This is a another version of stack data structure implementation using link representation. With this version the stack size is dynamic and determined at run-time.
1 | int empty(struct node *s); |
2 | struct node* push(struct node *s,int data); |
3 | struct node* pop(struct node *s,int *data); |
4 | void init(struct node* s); |
08 | void init(struct node* s){ |
12 | struct node* push(struct node* s,int data) |
14 | struct node* tmp = (struct node*)malloc(sizeof(struct node)); |
24 | struct node* pop(struct node *s,int *element) |
33 | int empty(struct node* s){ |
34 | return s == NULL ? 1 : 0; |
view source
Không có nhận xét nào:
Đăng nhận xét