西安哪些早市人流量大:指针变量 p++ p+1

来源:百度文库 编辑:九乡新闻网 时间:2024/05/08 05:10:59
#include
#include
#include
#include
int my_strlen(char *p)
{
   assert(NULL!=p);
   {
    return('\0'!=*p) ? (1+my_strlen(p++)):0 ;
   }
}
void main()
{
  char *p="abcde";
  printf("%d\n",my_strlen(p));
}
p++无法输出结果,p+1输出结果5已解决:p++时将会无穷递归,知道栈溢出自动退出,可定义变量int a,验证递归次数。