指针做参数传递写出下面的函数,实现计算字符串长,字符串复制功能

int strlen(char *s)

void strcpy( char *s, char *t)

 

 

1 int strlen(char *s)
2 {
3 char *ss;
4 ss=s;
5 while(*ss!='\0') ss++;
6 return ss-s;
7 }


 

 

1 void strcpy( char *s, char *t)
2 {
3 while((*s=*t)!='\0')
4 {
5 s++;
6 t++;
7 }
8 }

 

posted on 2012-02-10 12:40  pony1993  阅读(625)  评论(1编辑  收藏  举报

View My Stats