hi everyone,

I have a hard time understanding structs, dynamic memory allocation, and linked list.

Please explain to me what is going on in the following code.

Also the question ask to me to continue writing the function so that it reads the numbers of an input array and create a linked list whose elements are NUMBERS. It said i should dynamically allocate the memory of each NUMBER INSTANCE.

The array used in this question is {4,9,22,45,89,100}.

thanks in advance.

(Note: this is not my homework.....its a test question im trying to study).

Code:struct number { int a_number; struct number* next; }; typedef struct number NUMBER; NUMBER* load(int[] input_array, int size) { NUMBER* head = NULL; NUMBER* current = head; int i = 0; size = size -1; if(size>=0) // here is the generation of the head node { head = (NUMBER*)malloc(sizeof(NUMBER)); head->a_number = input_array[i++]; head->next = NULL; }