title: Iterate through string char by char
body: <p>I try to iterate through a string char by char. I tried something like this:</p>
  
  <pre><code>void print(const string&amp; infix)
  {
  char &amp;exp = infix.c_str();
  while(&amp;exp!='\0')
  {
           cout&lt;&lt; &amp;exp++ &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>So this function call print("hello"); should return:</p>
  
  <pre><code>h
  e
  l
  l
  o
  </code></pre>
  
  <p>I try using my code, but it doesn't work at all. btw the parameter is a reference not a pointer. Thank you</p>