题解 | #字符串连接#

字符串连接

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;
}

全部评论

相关推荐

点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务