User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:stdio.h:vprintf

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

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/stdio.h/vprintf.txt · Last modified: 2024/02/16 01:05 (external edit)

Impressum Datenschutz