The sprintf() function of the C language

<stdio.h>

prototype:

int sprintf(char *str, const char *format, …)

Send formatted output to the string pointed to by str.

parameter

str – This is a pointer to a character array that stores C strings.

format - This is the string containing the text to be written to the string str. It can contain embedded format tags, which can be replaced by values ​​specified in subsequent additional parameters, and formatted as desired. The format tag attribute is %[flags][width][.precision][length]specifier

Compare the prototype of printf(): int printf(const char *format, …)

The first argument to sprintf() is the address of the target string. The remaining arguments are the same as for printf() — a conversion specification string followed by a list of items to be written.

Guess you like

Origin blog.csdn.net/chengkai730/article/details/132397571