3 回答

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超4個(gè)贊
/*
原 串 : Windows Application
目標(biāo)串 : Windows Application
請(qǐng)按任意鍵繼續(xù). . .
*/
#include <stdio.h>
#include <stdlib.h>
char *strcopy(char ds[], char ss[]) {
int i = 0;
while(ds[i] = ss[i]) ++i;
return ds;
}
int main() {
char s[] = "Windows Application";
char d[20];
printf("原 串 : %s\n",s);
printf("目標(biāo)串 : %s\n",strcopy(d,s));
system("pause");
return 0;
}

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊
#include <stdio.h>
char* cpystr(char *des, char *res)
{
for(int i= 0; res[i]!='\0'; i++)
des[i]= res[i];
des[i]= '\0';
return des;
}
int main (void)
{
char d[30], s[]= "12345";
cpystr(d, s);
puts(d);
return 0 ;
}
- 3 回答
- 0 關(guān)注
- 1325 瀏覽
添加回答
舉報(bào)