title: Converting a 4 bit key to an 8 bit one in C
body: <p>I am trying to convert a 4 bit key like "0110" to an 8 bit key like "0110 0110" where it reads in each character of the 4 bit key using getchar() and then converts it.</p>
  
  <p>I have tried using a character that has an 8 bit key of just zeroes and then using bitwise OR with the given key to convert it, but this doesn't result in the right number.</p>
  
  <pre><code>char bit_key = 0x00;
  printf("enter 4-bit key: ");
  value = getchar();
  while (i &lt; 4) {
      bit_key = bit_key | (char) value;
      i++;
      value = getchar();
  }
  </code></pre>