How come std::cout works fine for [] = "12345" but not for [] = {'1','2','3','4','5'}?
<p>I've noticed a weird discrepancy in C++.</p>

<p>Say I have this code:</p>

<pre><code>const char myChars[] = "12345";
std::cout &lt;&lt; myChars;
</code></pre>

<p>The output is: 12345</p>

<p>However, if I then change it to:</p>

<pre><code>const char myChars[] = {'1','2','3','4','5'};
std::cout &lt;&lt; myChars;
</code></pre>

<p>Then the output is: 12345__SOME_RANDOM_DATA_IN_MEMORY__</p>

<p>Why is it that cout appears to know the length of the first version but not the length of the second version? Also, does cout even know the length?</p>

<p>Thanks.</p>
