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

推荐订阅源

WordPress大学
WordPress大学
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
Engineering at Meta
Engineering at Meta
Martin Fowler
Martin Fowler
H
Help Net Security
B
Blog
Y
Y Combinator Blog
小众软件
小众软件
S
SegmentFault 最新的问题
I
InfoQ
爱范儿
爱范儿
Hugging Face - Blog
Hugging Face - Blog
D
Docker
博客园 - 【当耐特】
J
Java Code Geeks
阮一峰的网络日志
阮一峰的网络日志

博客园 - 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)    收藏  举报