title: How to generate a function to print char [ ] array in C++?
body: <p>I'm trying to write a small function for printing char array that contains <strong>0</strong> in middle and end. My function doesn't print it correctly, what I'm missing :-(<br>
  Expected result: <strong>Good-bye0ld0</strong> 
  Actual: <strong>Good-bye ld</strong> </p>
  
  <pre><code>// call function 
  char str5[] = { 'G','o','o','d','-','b','y','e',0,'l','d',0 };
      displayResult(str5);
  
  // This is function 
  
       void displayResult(string _st)
      {
          int l = _st.length();
          for (int i = 0; i&lt;=l; i++)
      {
          cout &lt;&lt; _st[i];
          //printf("%s\n", _st[i]);
      }
      cout &lt;&lt; endl;
      }
  </code></pre>