โ Back to Structs
Question 340
Swap Two Structs
Swap Two Structs
Two points are given:a = {1, 2}andb = {3, 4}. Swap their contents so thataholds{3, 4}andbholds{1, 2}, using a temporary struct. Then print all four values asa.x a.y b.x b.y: 3 4 1 2 Because struct assignment copies whole structs, a single temp works. There is no trailing newline.
Expected Output:
3 4 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.