3
A
回答
7
int
具有隐式转换到bool
。基本上0
转换为false
,所有非零值转换为true
所以更冗长,你的病情会读
while (x != 0)
0
由于@CoryKramer说,当你拥有只包含一个可变的条件,即使是一个char,int,float等,值0被认为是false,而其他任何其他都是true。如果您使用的指针是相同的:NULL值被视为false,并且任何其他方向都被视为true。
相关问题
- 1. while循环条件在c
- 2. C#在while循环内退出while循环for if条件
- 3. C while循环多个条件数学
- 4. c while循环停止前条件
- 5. while循环中的多个条件C++
- 6. 两个条件while循环
- 7. while循环中的条件
- 8. while循环退出条件
- 9. JavaScript While循环条件Abbration
- 10. while循环条件 - matlab
- 11. 分配条件While循环
- 12. While while循环条件中的数字
- 13. for循环while while循环+附加条件
- 14. for循环里面while循环使用条件如果条件
- 15. C#foreach while while循环
- 16. C++ Space while while循环
- 17. 在while循环之外更改条件变量的状态for while while循环
- 18. C++ cin.fail()while循环
- 19. 在C++ while循环
- 20. C#while循环onclose
- 21. do-while循环C++
- 22. while循环在C#
- 23. C++:CIN while循环
- 24. C++ do-while循环
- 25. C do-while循环
- 26. while while while循环while循环
- 27. while循环中的多个条件PHP
- 28. while循环内if语句条件
- 29. while循环精度为条件
- 30. Python while循环条件使用时间
应该可能是'while(cin >> x){',但从给出的这种狭窄的上下文无法分辨出来。 –