Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef LIST_H_INCLUDED
- #define LIST_H_INCLUDED
- // kruzna lista sa granicnikom
- typedef struct node {
- int data;
- struct node *next;
- } node;
- /*
- void init(node **l);
- void addBegin(node *l, int s);
- void addEnd(node **l, int s);
- void init(node **l){
- *l = (node*) malloc(sizeof(node));
- (*l)->next = *l;
- };
- */
- void addBegin(node *l, int s){
- node *temp = (node*) malloc(sizeof(node));
- temp->data = s;
- temp->next = l->next;
- l->next = temp;
- };
- void addEnd(node **l, int s){
- node *temp = (node*) malloc(sizeof(node));
- // dodajemo podatak u granicnik
- (*l)->data = s;
- temp->next = (*l)->next;
- (*l)->next = temp;
- *l = temp;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement