returning to the head of linked list
Posted on 2000-03-08
can anyone tell me the easiest way to go back to the head of the linked list at the end of the code below? i dun wish to add anything inside my struct unless i really have no choice.
inside my struct, i have a pointer
pointing to the nextPtr
thanks in advance!
ctr = 0;
if(*startPtr != NULL)
while(*startPtr != NULL)
//delete one node from list
//only enter here once
(*startPtr) = (*startPtr)->nextPtr;
//go back to the head of the linked list before printing the linked list, else the list would be empty.