Why sizeof() of a string variable always return the same number even when content changes?
<p>This is a rather simple problem but is pretty confusing.</p>

<pre><code>string R = "hhhh" ;
cout&lt;&lt; sizeof( R )&lt;&lt;endl;
</code></pre>

<p>OUTPUT:</p>

<pre><code>4
</code></pre>

<p><strong>Variation:</strong> </p>

<p>string R = "hhuuuuuuhh" ;
cout&lt;&lt; sizeof( R )&lt;

<p>OUTPUT2: </p>

<pre><code>4
</code></pre>

<p>What is going wrong ? Should I use char array instead ?</p>