qfedu-c-level/day12/d3_2.c

12 lines
288 B
C
Raw Permalink Normal View History

// sprintf() 实现字符串与字符串拼接,字符串与数字拼接,数字与数字拼接
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buf1[20] = "hello";
char buf2[20] = "world";
sprintf(buf1, "%s %s", buf1, buf2);
printf("%s", buf1);
return 0;
}