title: How does the conversion of int value to unsigned char in memset() work?
body: <pre><code>void * memset ( void * ptr, int value, size_t num );
  </code></pre>
  
  <p><code>memset()</code> sets the first num bytes of ptr to value. I want to use <code>memset()</code> to set all bytes of a void buffer to:</p>
  
  <pre><code>00000000
  11111111
  10101010
  01010101
  </code></pre>
  
  <p>For "00000000" I can use</p>
  
  <pre><code>memset(buffer, '0', BUF_LENGTH);
  </code></pre>
  
  <p>But am I right to assume</p>
  
  <pre><code>memset(buffer, '1', BUF_LENGTH);
  </code></pre>
  
  <p>won't end in "11111111", but in "00000001"? I've read that '-1' would do the trick, but why? And what value would i need to set bitwise 10101010 or 01010101? </p>