#include <stdio.h>main(){char str[50],*p=str;printf("enter string:");gets(str);while(*p)p++;printf("string lenth=%d\n",p-str);}
3 回答

Jabin_Aronvoy
TA贡献2条经验 获得超0个赞
在这里*p尽管是一个指向字符的指针,但把它放在while的条件判定中时它会隐式转换为bool类型。当p为空时为false,当p不为空则为true。
- 3 回答
- 0 关注
- 2031 浏览
添加回答
举报
0/150
提交
取消