- 示例代码
#include <iostream>
using namespace std;
int main()
{char* str1 = "Hello";char*str2 = "World";//方式一char str3[20];strcpy(str3, str1);strcat(str3, str2);cout << str3 << endl;//方式二//char str3[20];sprintf(str3,"%s%s",str1,str2);cout << str3 << endl;return 0;
}