摘要: 每日一题 -- 不适用变量实现c语言的strlen函数问题描述:编写一个c语言函数strlen,要求在其中不能够使用任何的变量思路:如果在函数体重不能使用变量,同时考虑到斐波那契数列的递归求解的过程,可以联想到使用“递归”来实现。实现代码:#include<stdio.h>#include<stdlib.h>//strlen实现,但是在其中不能使用任何变量intmyStrlen(char*str){if('\0'==*str){return0;}else{return(1+myStrlen(str+1));}}intmain(){char*str=&qu 阅读全文
posted @ 2010-11-19 15:49 qiang.xu 阅读(471) 评论(0) 推荐(0) 编辑