title: Why is this the output using pointing c++
body: <p>I don't know why this code gives the result it does.  I thought the pointer <code>p</code> should be the address of <code>str</code> and the output should always be the address in the while loop.  Why is the result is the real value of <code>str</code> like that?</p>
  
  <pre><code>char str[] = "we are poor students";//这是一个字符串
  cout&lt;&lt;str&lt;&lt;endl;
  char *p = str;
  while (*p != '\0')
  {
      cout &lt;&lt; p&lt;&lt;endl;
      p++;
  }
  return 0;
  </code></pre>
  
  <p>This is the result it gives:</p>
  
  <blockquote>
  <pre><code>we are poor students
  we are poor students
  e are poor students
   are poor students
  are poor students
  re poor students
  e poor students
   poor students
  poor students
  oor students
  or students
  r students
   students
  students
  tudents
  udents
  dents
  ents
  nts
  ts
  s
  </code></pre>
  </blockquote>