References and argument passing
Initialization of objects and function calls
References
Pass by reference
When do we pass arguments by reference?
Guidance for passing arguments
Activity: Append an array's content to an std::vector
Graded Playground Autograder
In this problem, you will implement the function AppendArrayToVector. This function will append the contents of an integer array to the back of an integer vector.
AppendArrayToVector's return type will be void, and it will specify three parameters: array, array_size, and vector typed int[], unsigned int, and std::vector<int> respectively. Following the conventions outlined in the lessons, you must correctly determine how each argument should be passed to AppendArrayToVector: by value, reference, or constant reference.
You will define AppendArrayToVector such that each array element is appended to the back of the std::vector<int>. You will append the elements residing in the array in ascending index order. You will begin at the array's index 0 and visit each element in order.