递归计算字符串长度

摘自某公司的笔试题目,挺有意思的。不过不大实用,效率问题。

int whatido(char * str)
{
    return *str ? whatido(++str)+1 : 0;
}

posted on 2011-05-07 23:18  Joshua Leung  阅读(416)  评论(0编辑  收藏  举报

导航