Question 6
Back to Exercise
Why is void print(const std::vector<int>& v) a good signature?
- A It copies the vector for safety
- B It avoids copying the vector and guarantees the function will not modify it Correct
- C It lets the function resize the vector
- D It is required for vectors
Correct Answer: Option B
It also accepts temporaries, such as print({1, 2, 3}).
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!