New answers tagged

0

My understanding is that list is a pointer variable initialised without a value No. It's initialized to NULL. That's what the = NULL part does. A variable can't be initialized without a value. Initializing means assigning a value. Uninitialized meaning memory is allocated, but you didn't write anything to it. Maybe this is what you meant, a pointer being ...


1

In your insertNode function, while your iterating to find the last node, you should check whether the next_node is NULL, not current_node is NULL. Let's say, we had two nodes 1 -> 2 -> NULL head When you start iterating, using while(current != NULL) current = current -> next; It will eventually reach the node 2. Now this is the last ...


Top 50 recent answers are included