title: fwrite writes out bytes, not the actual integer
body: <p>I'm completing an assignment wherein I need to output data like this:</p>
  
  <pre><code>255 0 0 255 0 0 255 0 0
  255 0 0 255 0 0 255 0 0
  255 0 0 255 0 0 255 0 0
  </code></pre>
  
  <p>What came to mind first was to output a pixel at a time but my professor wants me to output it all at once by using fwrite.</p>
  
  <p>Every time I use fwrite I end up having my output as actual bytes, not integers.</p>
  
  <p>How can I fix this?</p>
  
  <pre><code>int rows = 3;
  int cols = 3;
  int imgsize = (3 * rows * cols);
  unsigned char *img = malloc(imgsize);
  int ri = 0;
  int ci = 0;
  
  for (ri = 0; ri &lt; rows; ri++) {
       for (ci = 0; ci &lt; cols; ci++) {
           *img = 255;
           *(img + 1) = 0;
           *(img + 2) = 0;
           img += 3;
       }
   }
  
   FILE *fp = fopen("output", "w");
   fwrite(img, 1, imgsize, fp);
   fclose(fp);
  </code></pre>