{{keywords>wiki library source code example reference}}
====== 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 [[c:stdio.h:puts|]] and [[c:stdio.h:vsprintf|]].
===== C Sourcecode Example =====
/*
* vprintf example code
* http://code-reference.com/c/stdio.h/vprintf
*/
#include /* including standard library */
//#include /* uncomment this for Windows */
#include /* 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