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

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   pony1993  阅读(626)  评论(1编辑  收藏  举报
努力加载评论中...

Statcounter View My Stats
点击右上角即可分享
微信分享提示