如何将两个数组的字符串合并成一起(写函数)?
例子如下Input
hello ABC
Output
helloABC
main函数
程序代码:
#include <stdio.h> int main() { void myStrcat(char[], int, char[], int); char firstStr[101]; char secondStr[51]; int firstStrLength = 0, secondStrLength = 0; scanf("%s %s", firstStr, secondStr); while (firstStr[firstStrLength++]) {} while (secondStr[secondStrLength++]) {} myStrcat(firstStr, firstStrLength-1, secondStr, secondStrLength-1); printf("%s\n", firstStr); return 0; }
写myStrcat()函数?