title: How to display a uint8_t as an integer or string?
body: <p>I am trialling a function that converts decimal numbers to binary, and I want to see if it is working or not. The problem is I am writing it in C for a Teensy micro controller, and I don't have many of the basic operations like printf. I am using a library that can only send information to the LCD screen as a string or double, so my only way to check if this function is working is to send the binary number to the LCD screen as a string or integer (if the binary number was 1010, the integer number would be 1010, not 10). </p>
  
  <p>The libraries I am able to use are:</p>
  
  <pre><code>stdint
  stdio
  avr/io
  avr/interrupt
  util/delay
  stdlib
  </code></pre>
  
  <p>Does anyone know how this can be done using the above libraries only?</p>
  
  <p>EDIT: Included code as per comment request. The code I have used to convert the decimal to binary is:</p>
  
  <pre><code>uint8_t dec_to_bin(void){
      int n = 100;
      long long binaryNumber = 0;
      int remainder, i = 1;
  
      while (n!=0){
          remainder = n%2;
          n /= 2;
          binaryNumber += remainder*i;
          i *= 10;
      }
      return binaryNumber;
  }
  </code></pre>
  
  <p>Then in the main function I have:</p>
  
  <pre><code>uint8_t a = dec_to_bin();
  sprintf(a, "%u");
  </code></pre>
  
  <p>This returns the error:  error: passing argument 1 of 'sprintf' makes pointer from integer without a cast</p>