title: Subtracting two binary in char arrays
body: <p>I am a new member of the forum. I am trying to subtract two binary numbers which the bits are stored as char in an array. I have number as an structure: </p>
  
  <pre><code>struct number {
      unsigned char *digits; 
      size_t number; 
  };
  </code></pre>
  
  <p>And I subtract in another function: </p>
  
  <pre><code>void subtractionTwoBinaryNumbers(number &amp;firstNumber, number &amp;secondNumber) {
      for (size_t i = firstNumber.number; i &gt; 0; i--) {
          unsigned char mask = 0b00000001;
          for (int j = CHAR_BIT - 1; j &gt;= 0; j--) {
              if (((mask &amp; firstNumber.digits[i - 1]) &gt; (mask &amp; secondNumber.digits[i - 1])) ||
                  ((mask &amp; firstNumber.digits[i - 1]) == (mask &amp; secondNumber.digits[i - 1]))) {
                  firstNumber.digits[i - 1] = ((mask &amp; firstNumber.digits[i - 1]) - (mask &amp; secondNumber.digits[i - 1]));
  
              } else if ((mask &amp; firstNumber.digits[i - 1]) &lt; (mask &amp; secondNumber.digits[i - 1])) {
                  firstNumber.digits[i - 1] = ((mask &amp; secondNumber.digits[i - 1]) - (mask &amp; firstNumber.digits[i - 1]));
              }
              mask &lt;&lt;= 1;
          }
      }
  }
  </code></pre>
  
  <p>I'm printing the number in another function and it runs correctly.
  I would like compute the score in firstNumber.digits. But the score is:</p>
  
  <pre><code>first number: 00001111
  second number: 00000101
  score: 00000000
  </code></pre>
  
  <p>What did I do wrong? Thank you for each answer on my questions!</p>