1. For integer, there are some functions that can be specially converted on various platforms, such as itoa.
However, it is more common to use the sprintf function. ?
2. Statement:
int sprintf(char *dst,const char *format_string,...);
The header file is stdio.h
3. Function:
Sprintf is an indefinite parameter function. According to the format characters provided in format_string, the subsequent parameters are converted into strings and stored in the first parameter dst.
4. Use examples:
Short? a = 1;
int? b = 2;
Dragon? c = 3;
Floating? d = 4;
Charles? buf[ 100];
sprintf(buf,? " %hd? %d? %ld? %f”,a,b,c,d); //According to the format, four variables are stored in a string. After execution, the string in buf is "1 2 3 4.000000".
Format strings are used in the same way as the output function printf. ?