#include <stdio.h>int sprintf(char *buf, const char *format, ...);
The sprintf( ) function is identical to printf( ) except that the output is put into the array pointed to by buf instead of being written to the stdout. The array pointed to by buf is null-terminated. See printf( ).
In C99, buf and format are qualified by restrict.
The return value is equal to the number of characters actually placed into the array.
It is important to understand that sprintf( ) provides no bounds checking on the array pointed to by buf. This means that the array will be overrun if the output generated by sprintf( ) is greater than the array can hold. See snprintf( ) for an alternative.
Related functions are printf( ) and fsprintf( ).