title: Are vectors passed to functions by value or by reference in C++
body: <p>I'm coding in C++. If I have some function <code>void foo(vector&lt;int&gt; test)</code> and I call it in my program, will the vector be passed by value or reference? I'm unsure because I know vectors and arrays are similar and that a function like <code>void bar(int test[])</code> would pass test in by reference (pointer?) instead of by value. My guess is that I would need to pass the vector by pointer/reference explicitly if I wanted to avoid passing by value but I'm not sure.</p>