In the C language, we often use the sprintf function to convert integer, floating-point, and character variables into a string.
Print formatted output into a string
#include <stdio.h>
int sprintf( char* buf,
const char* format,
... );
示例:
char ch[20];
int value = 20;
sprintf(ch,"%d\r\n",value);