问题详情

下列程序中的函数 strcpy2() 实现字符串两次复制 , 即将 t 所指字符串复制两次到 s 所指内存空间中 ,合并形成一个新的字符串。例如,若 t 所指字符串为 efgh ,调用 strcpy2 后, s 所指字符串为 efghefgh 。请填空。

#include <stdio.h>

#include <string.h>

void strcpy2(char *s,char *t)

{ char *p=t;

while(*s++=*t++);

s= 【 1 5 】 ;

while( 【 1 6 】 =*p++);

}

main()

{ char str1[100]="abcd",str2[]="efgh";

strcpy2(str1 ,str2); printf("%s\n",str1);

}

参考答案
您可能感兴趣的试题