โ Back to Structs
Question 349
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->: 1 -> 2 The two nodes can be plain local variables. There is no trailing newline.
Expected Output:
1 -> 2
Topics:
Structs
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.