C++ strings passing in function with pointer
<p>I am not unable to understand how the c++ string pointer are working in the function passing.</p>

<pre><code>void print(string str){
     str+=" and sisters."; 
}
int main(){
    string s ="hello brother";
    print(s);
    cout&lt;&lt;s&lt;&lt;endl;
</code></pre>

<p>}</p>

<p>Output:</p>

<pre><code>hello brother
</code></pre>

<p>and for below function -</p>

<pre><code>void print(string &amp;str){
    str+=" and sisters.";
}
int main(){
    string s ="hello brother";
    print(s);
    cout&lt;&lt;s&lt;&lt;endl;
}
</code></pre>

<p>Output-</p>

<pre><code>hello brother and sisters.
</code></pre>

<p>I am unable to understand how the pointers are working in case of "string &amp;str" and 
"string str" since I am passing the same string object.</p>