CJCoding With Joseph
15free / daySign inCreate account

Swap Two Structs

Two 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
Topics:
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.