Swap Two Structs
mediumQuestion 410Two points are given: a = {1, 2} and b = {3, 4}. Swap their contents so that a holds {3, 4} and b holds {1, 2}, using a temporary struct. Then print all four values as a.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.