โ Back to Structs
Question 148
Scale a Vector Struct
Scale a Vector Struct
A Vector struct (int x, y) is defined. Complete the function scale so it multiplies BOTH fields of the vector by a factor, modifying the original through a pointer. The main function reads a vector and a factor, calls scale, and prints the result. Example: vector (2, 3) scaled by 4 becomes '8 12'.
Expected Output:
8 12
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.