title: In C++, why is & needed for some parameters?
body: <p>I'm a Python programmer learning C++. In Python, parameters are passed to functions as copies (assuming that parameters are non-mutable). This means that the original values of parameters are not local to stuff happening inside the function and therefore can't be changed.</p>
  
  <p>In this following C++ snippet, I see that this function takes in a reference of s, which, if edited inside the function, can change the original value of s. I don't understand why this is the convention, aka. why &amp;s is used instead of s.</p>
  
  <pre><code>void write_comment(const std::string &amp;s) {
    std::cout &lt;&lt; s &lt;&lt; std::endl;
  }
  </code></pre>