title: Why is a string passed as const string in a function parameter
body: <p>I am a bit confused about one of the examples in my textbook. When the string is created, it is created as type <code>string</code>.  However, when the same string is passed into a function, the function parameters are of <code>const string</code> and not  <code>string</code>.</p>
  <p>Here's the part of the code:</p>
  <pre><code>int main()
  {
      string str;
      cout &lt;&lt; &quot;blah blah..&quot;;
      getline(cin, str);
      if (is_pal(str))
      //...
  }
  
  bool is_pal(const string&amp; s)
  {
      //...
  }
  </code></pre>
  <p>Why is the function parameter <code>const string&amp; s</code> instead of just <code>string&amp; s</code>?  I've read through my textbook but can't seem to find any explanation for this.</p>