Its very simple. You need to be using the va_ functions

Code: C
int my_printf( char *fmt, ... )
{
  va_list  argptr;      /* Argument list pointer  */
  char str[140];            /* Buffer to build sting into   */
  int cnt;        /* Result of SPRINTF for return */

  va_start( argptr, format );      /* Initialize va_ functions    */
  cnt = vsprintf( str, fmt, argptr );   /* prints string to buffer */

  va_end( argptr );   /* Close va_ functions      */
  return( cnt );            /* Return the conversion count  */

}