Ok so let’s say we have a linked list of characters with a head pointer. How can I create a loop to enter a string of characters into the linked list? My problem is when I think of head and head->next and head->next->next . . . it only seems natural to use a recursive function to set the characters at each node.
Share
It’s trivial to do it with iteration. You would just start at head, and use a loop to iterate over the list by doing
current = current->next, until you hit a NULL.Basically something like: