โ Back to Structs
Question 344
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: 4 6 The function must return astruct Vecby 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.