← Back to Structs
Question 414
Add Two Vectors
Add Two Vectors
Write a functionaddthat takes twostruct Vecvalues and returns a newstruct Vecwhose fields are the component-wise sums. Inmain,a = {1, 2}andb = {3, 4}are added and the result is printed asx y(see Expected Output). The function must return astruct Vecby 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.