Add Two Vectors
mediumQuestion 414Write 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 (see Expected Output).
The function must return a struct Vec by value. There is no trailing newline.
Expected output
4 6= newline. No newline after the last line.
Hints4 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.