C Code Reorder Medium +20 XP
Linked List Node
Arrange the linked list node creation.
Click lines in the correct order
Available lines4 left
Your order
Click lines above to build your solution.
Show answer and explanation
Answer: struct Node *node = malloc(sizeof(struct Node));
if (!node) return NULL;
node->data = 42;
node->next = NULL;
Allocate, check for NULL, then initialize the fields.
Hint: Always check malloc before using the pointer.
What this challenge tests
Code Reorder in C: linked-list, malloc.