以下是一个用 C 语言实现将两个输入字符串交织在一起的函数: ```c #include <stdio.h> #include <string.h> void interleaveStrings(char *str1, char *str2, char *result) { int len1 = strlen(str1); int len2 = strlen(str2); int i = 0, j = 0, k = 0; while (i < len1 && j < len2) { result[k++] = str1[i++]; result[k++] = str2[j++]; } while (i < len1) { result[k++] = str1[i++]; } while (j < len2) { result[k++] = str2[j++]; } result[k] = '\0'; } int main() { char str1[] = "abc"; char str2[] = "123"; char result[100]; interleaveStrings(str1, str2, result); printf("%s\n", result); return 0; } ``` [2024-09-17 16:38:40 | AI写代码神器 | 257点数解答]