指针作业


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

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 }
原文地址:https://www.cnblogs.com/pony1993/p/2345164.html