Why can't I modify a vector that I pass by reference?
<p>This is the first time I'm trying to use pass by reference with vectors. I thought I did it correctly, but I get <code>error: no viable overloaded '='</code> on the line that tries to assign <code>a[0] = 5</code></p>

<pre><code>void BubbleSort(vector&lt;int&gt; *a) {
    int n = a-&gt;size(), numberOfSwaps = 0;   
    if (n &gt; 0)
        a[0]= 5;
}


int main(){
    // input size and array
    int n;
    cin &gt;&gt; n;
    vector&lt;int&gt; a(n);
    for(int a_i = 0;a_i &lt; n;a_i++){
       cin &gt;&gt; a[a_i];
    }
    // sort
    BubbleSort(&amp;a);
    // print
    for (auto i = a.begin(); i != a.end(); ++i)
        cout &lt;&lt; *i &lt;&lt; ' '; 

    return 0;
}
</code></pre>

<p>edit:</p>

<p>So now that I've been informed that I'm actually passing by pointer, my question is, should I be passing vectors by reference or by pointer, or does it not matter?</p>