7.19.6.6 The sprintf function
Synopsis
#include <stdio.h>
int sprintf(char * restrict s,
const char * restrict format, ...);
Description
The sprintf function is equivalent to fprintf, except that the output is written into an array (specified by the argument s) rather than to a stream. A null character is written at the end of the characters written; it is not counted as part of the returned value. If copying takes place between objects that overlap, the behavior is undefined.
Returns
The sprintf function returns the number of characters written in the array, not counting the terminating null character, or a negative value if an encoding error occurred.