title: C++ Pointer Char
body: <p>I'm new to C++ and I'm now learning about pointers. I'm trying to understand this program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main() {
      char *text = "hello world";
      int i = 0;
      while (*text) {
          i++;
          text++;
      }
      printf("Char num of &lt;%s&gt; = %d", text, i);
  }
  </code></pre>
  
  <p>It outputs:</p>
  
  <blockquote>
    <p><code>Char num of &lt;&gt; = 11</code></p>
  </blockquote>
  
  <p>But why not this:</p>
  
  <blockquote>
    <p><code>Char num of &lt;hello world&gt; = 11</code></p>
  </blockquote>