12 lines
288 B
C
12 lines
288 B
C
// 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;
|
|
} |