title: Sizeof string literal
body: <p>The following code</p>
  
  <pre><code>#include &lt;iostream&gt;    
  using namespace std;
  
  int main()
  {
      const char* const foo = "f";
      const char bar[] = "b";
      cout &lt;&lt; "sizeof(string literal) = " &lt;&lt; sizeof( "f" ) &lt;&lt; endl;
      cout &lt;&lt; "sizeof(const char* const) = " &lt;&lt; sizeof( foo ) &lt;&lt; endl;
      cout &lt;&lt; "sizeof(const char[]) = " &lt;&lt; sizeof( bar ) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>outputs</p>
  
  <pre><code>sizeof(string literal) = 2
  sizeof(const char* const) = 4
  sizeof(const char[]) = 2
  </code></pre>
  
  <p>on a 32bit OS, compiled with GCC.</p>
  
  <ol>
  <li>Why does <code>sizeof</code> calculate the length of (the space needed for) the string literal ?</li>
  <li>Does the string literal have a different type (from char* or char[]) when given to <code>sizeof</code> ?</li>
  </ol>