title: C printing bits
body: <p>I am trying to write a program in C that prints bits of int.
  for some reason i get wrong values,</p>
  
  <pre><code>void printBits(unsigned int num){
      unsigned int size = sizeof(unsigned int);
      unsigned int maxPow = 1&lt;&lt;(size*8-1);
      printf("MAX POW : %u\n",maxPow);
      int i=0,j;
      for(;i&lt;size;++i){
          for(j=0;j&lt;8;++j){
              // print last bit and shift left.
              printf("%u ",num&amp;maxPow);
              num = num&lt;&lt;1;
          }
      }
  }
  </code></pre>
  
  <p>My question, <strong>first</strong> why am i getting this result (for printBits(3)).</p>
  
  <blockquote>
    <p>MAX POW : 2147483648 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0<br />
    0 0 0 0 0 2147483648 214748364 8<br /></p>
  </blockquote>
  
  <p><strong>second</strong> is there a better way to do this ?</p>