C语言Sprintf用法
如图,两种简单用法
#include <iostream>
#include<stdio.h>
// 程序的主函数
int main()
{
char a[20];
a[0] = 'p';
a[1] = 't';
sprintf(&a[2],"%3s","asd");
sprintf(&a[5],"kjl");
for (int i = 0; i < 10; i++)
{
printf("%c ",a[i]);
}
system("pause");
return 0;
}
还没有评论,来说两句吧...