title: Dereferencing a pointer to an array?
body: <p>Referring to the line with the comment:</p>
  
  <ul>
  <li>Why does adding parenthesis in the example work to print all the contents of the array?</li>
  </ul>
  
  <p>The example prints "one", then prints garbage.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main() {
      const char* a[3] = { "one", "two", "three" };
      const char*(*p)[3] = &amp;a;
      for(int i = 0; i &lt; 3; i++) {
          std::cout &lt;&lt; *p[i] &lt;&lt; std::endl; // this line
      }
      return 0;
  }
  </code></pre>
  
  <p>It works after changing to this:</p>
  
  <pre><code>std::cout &lt;&lt; (*p)[i] &lt;&lt; std::endl;
  </code></pre>