title: How to display the maximum value of a unsigned long long in C?
body: <p>What am I doing wrong here?</p>
  
  <pre><code>$ cat size.c
  #include&lt;stdio.h&gt;
  #include&lt;math.h&gt;
  
  int main() {
  
  printf ("sizeof unsigned int = %d bytes.\n", sizeof(unsigned int));
  printf ("sizeof unsigned long long = %d bytes.\n", sizeof(unsigned long long));
  
  printf ("max unsigned int = %d\n", (int)(pow(2, 32) - 1));
  printf ("max unsigned long long = %lld\n", (unsigned long long)(pow(2, 64) - 1));
  
  }
  $ gcc size.c -o size
  $ ./size
  sizeof unsigned int = 4 bytes.
  sizeof unsigned long long = 8 bytes.
  max unsigned int = 2147483647
  max unsigned long long = -1
  $ 
  </code></pre>
  
  <p>I am expecting <code>18446744073709551615</code> as output instead of a <code>-1</code> at the last line.</p>
  
  <hr>
  
  <p>Okay, I completely missed that I was getting the wrong value for 2<sup>32</sup> - 1, which should have been 4294967295, not 2147483647. Things make more sense now.</p>