title: Convert decimal to binary in C
body: <p>I am trying to convert a decimal to binary such as 192 to 11000000. I just need some simple code to do this but the code I have so far doesn't work:</p>
  
  <pre><code>void dectobin(int value, char* output)
  {
      int i;
      output[5] = '\0';
      for (i = 4; i &gt;= 0; --i, value &gt;&gt;= 1)
      {
          output[i] = (value &amp; 1) + '0';
      }
  }
  </code></pre>
  
  <p>Any help would be much appreciated!</p>