0

c++ how do i give a vector as parameter in a function

i want to give a vector (int) as a parameter im c++

20th May 2019, 11:38 AM
Cat Sauce
Cat Sauce - avatar
2 Answers
+ 4
Olin Guerrero Passing vector to a function in C++ When we pass an array to a function, a pointer is actually passed. When a vector is passed to a function, a copy of the vector is created. For example, we can see below program, changes made inside the function are not reflected outside because function has a copy. source: https://www.geeksforgeeks.org/passing-vector-function-cpp/ I hope I was helpful
20th May 2019, 11:39 AM
Alessio Benvenuti
Alessio Benvenuti - avatar