while (a) { link* tmp = a; a = a->next; delete tmp; }