CJCoding With Joseph

Add Two Vectors

Write a function add that takes two struct Vec values and returns a new struct Vec whose fields are the component-wise sums. In main, a = {1, 2} and b = {3, 4} are added and the result is printed as x y:

4 6

The function must return a struct Vec by value. There is no trailing newline.

Expected Output:

4 6
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.