题解 | #字符串连接#
字符串连接
https://www.nowcoder.com/practice/40d83e5509b04d20825ae68fe35e9ca8
题目比较容易,这里大家主要需要记住的是
c语言中,字符串的结尾是'\0'
其他的就是遍历即可。
#include <stdio.h>
int main() {
char a[205], b[105];
while (scanf("%s %s", a, b) != EOF) {
int i = 0, k = 0;
while (a[i] != '\0') i++;
while (b[k] != '\0') a[i++] = b[k++];
a[i] = '\0';
printf("%s", a);
}
return 0;
}

查看12道真题和解析