My problem:strcat

自己写的strcat,

运行会有问题,

⊙⊙?

#include <stdio.h>

void strcat(char *s,char *t){

while(*s) //c中null可以代替0
s++;
while(*s++=*t++)
;

}

int main(){
char s[] = "Hello ";
char t[] = "World!";

//char *s = "Hello"; //指针,不能修改里面的内容
//char *t = "World";
char *p = s;

strcat(p,t);

printf("%s\n",s);


return 0;
}



posted @ 2012-01-30 21:00  zwein  Views(153)  Comments(0)    收藏  举报