title: what is the result of printf("%d\n", sizeof('a')) in C and C++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2172943/size-of-character-a-in-c-c">Size of character (&#39;a&#39;) in C/C++</a>  </p>
  </blockquote>
  
  
  
  <p>OS: linuxmint 32-bit</p>
  
  <p>Compiler: gcc &amp; g++</p>
  
  <p>I have try this code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      printf("%d\n",sizeof('a'));
      return 0;
  }
  </code></pre>
  
  <p>and I compile it with gcc , the result is <code>4</code>, and I change to g++, and it is <code>1</code></p>
  
  <p>then I use:
  <code>sizeof(char)</code>, and the result is <code>1</code></p>
  
  <p>I use:
  char s = 'a';
  printf('%d\n', sizeof(s));</p>
  
  <p>and the result is <code>1</code></p>
  
  <p>but I search in the Internet, and some people said that they get the result of <code>1</code> or <code>2</code>.</p>
  
  <p>So why there are so many different result?</p>