Sprintf in C : It's just like printf but output is sent to a string, rather than standard output.
It's used when we wish to store integers or floats in a string. The first argument is a pointer to string. Previous content of string are overwritten.
C programming code
int a = 1;
float b = 1.23;
char c = 'u', string = "My initial character array.";
sprintf(string, "Integer = %d, Float = %f, Character = %c.", a, b, c);