1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
- | | ! - | | | | ! - | | | | | | !
struct node { int key; struct node *next; }; struct node *head, *z, *t; listinitialize() { head = (struct node*)malloc(sizeof *head); z = (struct node *) malloc(sizeof *z); head->next = z; z->next = z; } deletenext(struct node *t) { t->next = t->next->next; } struct node *insertafter(int v, struct node *t) { struct node *x; x = (struct node * ) malloc(sizeof *x); x->key = v; x->next = t->next; t->next = x; return x; }