C语言中sprintf函数的用法

c语言中,我们经常使用sprintf函数来将整型,浮点型,字符型变量转换为一个字符串。


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);

猜你喜欢

转载自blog.csdn.net/modi000/article/details/112562812