C语言:字符串复制与连接的特殊应用

#include <stdio.h>
#include <string.h>
main()
{
    char a[10]="abc",b[10]="012",c[10]="xyz";
    strcpy(a+1,b+2);//b+2对应的字符2\0,结果bc改为2\0 ,所以a结果为a2 
    puts(strcat(a,c+1));//实际a2与yz连接 
    puts(a);
    puts(b);
    puts(c); 
    getchar();
 }

 

 

posted @ 2022-10-06 16:51  myrj  阅读(29)  评论(0编辑  收藏  举报