惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
B
Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
P
Proofpoint News Feed
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 叶小钗
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
腾讯CDC
博客园 - Franky
博客园 - 聂微东
V
Visual Studio Blog
GbyAI
GbyAI
Martin Fowler
Martin Fowler
罗磊的独立博客
Y
Y Combinator Blog

博客园 - HonestMan

面试百问 o,1的感悟 公司内部推荐 debain oracle insert method a linked list, find the node that the last node point to. Get balance noe Memory - HonestMan - 博客园 ShuffleMerge---microsoft's interview question 新手开始学习linux print all Permutation of a string An funy question! Google, hire me How to interview a programmer? Binary search tree convert to double linked list. Search in Binary tree spilt a list Remove repeat char from a string
wirte a function for counting a linked list length
HonestMan · 2007-09-18 · via 博客园 - HonestMan

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.

posted @ 2007-09-18 20:05  HonestMan  阅读(167)  评论(0)    收藏  举报