Table of Contents

vprintf

    int vprintf(const char *format, va_list arg);

Equivalent to printf with variable argument list replaced by arg, which must have been initialised by the va_start macro (and may have been used in calls to va_arg).
is used to generate a string from a format string and then print to standard output stdout. vprintf can understood as a combination of puts and vsprintf.

C Sourcecode Example

/* 
 * vprintf example code
 * http://code-reference.com/c/stdio.h/vprintf 
 */
 
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
 
#include <stdarg.h>  /* included for va_list */
 
int myprintf( char const * format, ... )
{
  va_list args;
  int n;
 
  printf("vprintf example :");
  va_start( args, format );
  n = vprintf( format, args );
  va_end( args );
 
  return n;
}
 
int main ( void )
{
  char string[] ="Hello";
 
   myprintf( " %s World\n", string);
 
   return 0;
}

output

  output:  ./vprintf 
  vprintf example : Hello World