CJCoding With Joseph

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:

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.