![]() ![]() ![]() | structures/list-insert-delete.c - Eksempler på anvendelse af insert_after og delete_after. | Lektion 12 - slide 29 : 36 Program 3 |
int main(void) { cons_cell *points, *pl; point p1 = {1,2}, p2 = {3,4}, p3 = {5,6}, p_new = {11,12}; points = cons(&p1, cons(&p2, cons(&p3, NULL))); insert_after(&p_new, tail(points)); pl = points; while (pl != NULL) { prnt_point(*((point*)(head(pl)))); pl = tail(pl); } printf("\n\n"); delete_after(points); pl = points; while (pl != NULL) { prnt_point(*((point*)(head(pl)))); pl = tail(pl); } return 0; }