将两个字符串连接起来,不能用strcat函数。

将两个字符串连接起来,不能用strcat函数。
将两个字符串连接起来,不能用strcat函数。
将两个字符串连接起来,不能用strcat函数。


char* str1=new char[]{"123" };
    char* str2 = new char[] {"234"};
    int s1 = strlen(str1);
    int s2 = strlen(str2);
    str1 = (char*)realloc(str1, s1 + s2 + 1);
    char* p = str1 + s1;
    while (*str2 != '\0') {
        *p++ = *str2++;
    }
    *p = '\0';