← 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= newline. No newline after the last line.
Hints2 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.