I know it's very simple but not easy. I decieded that I write it by hand. its similar to strLen funtion
Maybe i am a dummy.
I use C.
version 1
int Count(char *s){
int n=0;
while(*s){
n++;
s++;
}//while
return n;
}//Count
version 2
int Count(char *s){
int n=0;
for(;*s;s++)
n++;
return n;
}
ok, done.....if you feel that it's not good, please post your smart code...thanks a lot.
转载于:https://www.cnblogs.com/chenjiefree/archive/2007/09/18/897619.html