← Back to Structs
Question 419
Two-Node Linked List
Two-Node Linked List
Astruct Nodeholds anint valueand astruct Node *nextpointer (a self-referential struct). Build a two-node list where the first node has value 1 and points to a second node with value 2 (whosenextisNULL). Traverse the list from the head and print the values joined by->(see Expected Output). The two nodes can be plain local variables. There is no trailing newline.
Expected Output:
1 -> 2= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
Structs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.