#include <stdarg.h>
#include <stdio.h>
int vsprintf(char * __restrict__target-string,
const char * __restrict__format, va_list arg_ptr);
The vsprintf() function is equivalent to the sprintf() function, except that instead of being called with a variable number of arguments, it is called with an argument list as defined in stdarg.h. For a specification of the format string, see sprintf() — Format and Write Data.
Initialize the argument list by using the va_start macro before each call. These functions do not invoke the va_end macro, but instead invoke the va_arg macro causing the value of arg after the return to be unspecified.
If successful, vsprintf() returns the number of characters written target-string.
If unsuccessful, vsprintf() returns a negative value.