







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.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。