Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不是很理解判断字符tutorial02中连续判断数字的代码 (p++; ISDIGIT(*p); p++); #236

Closed
liuxiaomingskm opened this issue Feb 9, 2023 · 2 comments

Comments

@liuxiaomingskm
Copy link

Tutorail02Answer中下列代码 链接
for (p++; ISDIGIT(*p); p++);
不是很理解, 第一眼看上去因为p每次循环都自增2次 感觉应该会隔位判断,但是debug了一下 用12345 发现*p 显示如下
2 3 4 5
并没有跳过2,4 有点不太理解

@imdouyu
Copy link
Contributor

imdouyu commented Feb 24, 2023

这里的第一个p++是跳过前一行已经做过判断的数字,第二个p++,是每次循环指针自增1,也就是循环开始后第一个p++不在参与循环的

@liuxiaomingskm
Copy link
Author

是的哦 第一个p只是定义 忘了 谢谢指点~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants