/*
Date: 10/03/19 12:49
Description: 求字符串长度函数实现的三种方法
*/
1 #include<stdio.h> 2 3 4 int strlen1(char *s); 5 int strlen2(char *s); 6 int strlen3(char *s); 7 8 9 int main(void) 10 { 11 char str[]="The function to test my length."; 12 printf("The length1 is:%d ",strlen1(str)); 13 printf("The length2 is:%d ",strlen2(str)); 14 printf("The length3 is:%d ",strlen3(str)); 15 16 } 17 18 19 int strlen1(char *s)//设置计数器 20 { 21 int count=0; 22 while(*s!='