C语言学习(24)

 1 //用字符串指针作为函数参数,试下字符串的复制
 2 #include<stdio.h>
 3 void cpystr(char *pss,char *pds){
 4     while(  (*pds=*pss)!='\0' ){
 5         pss++;
 6         pds++;
 7     }
 8 }
 9 
10 int main(){
11     char *pss="This is a book",b[100],*pds;
12     pds=b;
13     cpystr(pss,pds);
14     printf("复制后的字符串为:%s\n",pds);
15     return 0;
16 }

猜你喜欢

转载自www.cnblogs.com/Tobi/p/9237830.html