title: from int to char array
body: <pre><code>char ToByte(bool b[8])
  {
      char c = 0;
      int j = 0;
      for (int i = 7; i &gt;= 0; i--) {
          if (b[j]) {
              c |= 1 &lt;&lt; i;
          }
          j++;
      }
      return c;
  }
  </code></pre>
  
  <p>This function converts from bool to char</p>
  
  <pre><code>   int main() {
          int number = 979899101;
  
          bitset&lt;32&gt; byte4= number;
          cout &lt;&lt; byte4 &lt;&lt; endl;;
          bitset&lt;8&gt; byte;
          char op[4];
          for (int i = 3; i &gt;= 0; i--) { 
              for (int j = 0; j &lt; 8; ++j)
                  byte[j] = byte4[i * 8 + j];
              cout &lt;&lt; byte;
  
              bool var[8];
              for (int j = 0; j &lt; 7; ++j)
                  var[j] = byte[j];
  
              op[i]=ToByte(var);
          }   
          cout &lt;&lt; op; 
      }
  </code></pre>
  
  <p>I'm trying to get convertion from integer to char array but I'm getting bad result.          like ╗I↨]╠╠╠╠╠╠╠╠Ţ        I don't know what I'm doing wrong.</p>