title: Passing a variable in string in Embedded C
body: <p>I am using ATmega8 and I am trying to send string over USART (in <code>printf</code> style) which include a variable .I am using <code>Atmel Studio 6.2</code> as IDE for AVR programming. Here is my code:-</p>
  
  <pre><code>#define F_CPU 8000000UL
  #include &lt;avr/io.h&gt;
  #include &lt;util/delay.h&gt;
  
  void USARTInit(uint16_t ubrr_value)  // initialize USART
  {
  
      UBRRL = ubrr_value;
      UBRRH = (ubrr_value&gt;&gt;8);
      UCSRC|=(1&lt;&lt;URSEL)|(1&lt;&lt;UCSZ1)|(1&lt;&lt;UCSZ0);
      UCSRB=(1&lt;&lt;RXCIE)|(1&lt;&lt;RXEN)|(1&lt;&lt;TXEN);
  
  }
  
  void USARTWriteChar(char data) // send character using USART
  {
  
      while(!(UCSRA &amp; (1&lt;&lt;UDRE)));
      UDR=data;
  }
  
  void send_string(char s[])   // send string using USART
  {
      int i =0;
  
      while (s[i] != 0x00)
      {
          USARTWriteChar(s[i]);
          i++;
      }
      USARTWriteChar('\n');
  }
  
  
  int main(void)
  {
      USARTInit(51);
      char val='A';
      while(1)
      {
          send_string("Value = %c",val);
  
      }
  }
  </code></pre>
  
  <p>Now when I compile my code I got this error:-</p>
  
  <blockquote>
    <p>too many arguments to function 'send_string`</p>
  </blockquote>
  
  <p>So, clearly it is not accepting <code>%c</code> as it does in C programming. Is there a way in <code>embedded C</code> to pass a variable in a string?</p>