How is "vprintf()" used in C++?
Type | Description |
c | Character |
d or i | Signed decimal integer |
e | Scientific notation using e character |
E | Scientific notation using E character |
f | Decimal floating point |
g | Use the shorter of %e or %f |
G | Use the shorter of %E or %f |
o | Signed octal |
s | String of characters |
u | Unsigned decimal integer |
x | Unsigned hexadecimal integer |
X | Unsigned hexadecimal integer(capital) |
p | Pointer address |
% | A % followed by another % character will write % to the stream. |
#include <stdio.h> #include <stdarg.h> void Form (char * format, ...) { va_list args; va_start (args, format); vprintf (format, args); va_end (args); } int main () { Form ("Function with %d variable argument.\n",1); Form ("Function with %d variable %s.\n",2,"arguments"); return 0; } |