C/C++ 字串 組合/串接 [strcat]
C/C++ 字串 組合/串接 [strcat]
資料來源: https://shengyu7697.github.io/cpp-string-append/
線上編譯: https://www.tutorialspoint.com/compile_c_online.php
https://www.tutorialspoint.com/compile_cpp_online.php
Code
#include <stdio.h>
#include <string.h>
int main() {
const char *str1 = "hello";
const char *str2 = "world";
char dest[64] = {0};
strcat(dest, str1);
strcat(dest, " ");
strcat(dest, str2);
printf("dest: %s\n", dest);
return 0;
}