[Solved] What is the list that is being built by this code?


l is pointing to the head of a linked list.
So l is assigned NULL to start with, i.e. empty linked list.

In the first iteration of the for-loop a node is created and assigned the value “06”. l is set to point to the newly created node. So you have:

l —> (“06”, NULL)

In the second iteration of the for-loop a node is created and assigned the value “24”. l is set to point to the newly created node. So you have:

l —> (“24”, next=—)—> (“06”, next=NULL)

In the third iteration of the for-loop a node is created and assigned the value “3”. l is set to point to the newly created node. So you have:

l —> (“3”, next=—)—> (“24”, next=—)—> (“06”, next=NULL)

The the end you have a linked list where elements are inserted in the front.

solved What is the list that is being built by this code?