← Back to Structs
Question 410
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(see Expected Output). Because struct assignment copies whole structs, a single temp works. There is no trailing newline.
Expected Output:
3 4 1 2= newline. No newline after the last line.
Hints3 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.