while(1) 是什么意思? while(1)是什么意思?

while(1) \u4ec0\u4e48\u610f\u601d while(i--)\u4ec0\u4e48\u610f\u601d\uff1f

while(1)\u5176\u4e2d1\u4ee3\u8868\u4e00\u4e2a\u5e38\u91cf\u8868\u8fbe\u5f0f\uff0cwhile(1) \u8868\u793a\u65e0\u9650\u5faa\u73af\uff0c\u9664\u975e\u4f60\u8bbe\u7f6ebreak\u7b49\u7c7b\u4f3c\u7684\u8df3\u51fa\u5faa\u73af\u8bed\u53e5\u5faa\u73af\u624d\u4f1a\u4e2d\u6b62
while(i--)\u5176\u4e2di\u662f\u4e00\u4e2a\u53d8\u91cf\uff0c\u56e0\u6b64\u8868\u8fbe\u5f0fi--\u6709\u4e0d\u540c\u7684\u503c\uff0c\u4f9d\u6b21\u9012\u51cf\uff0ci--\u662f\u5148\u53d6\u503c\u540e\u51cf\uff0c--i\u5148\u52a0\u540e\u53d6\u503c,\u6240\u4ee5i--\u7684\u503c\u540c\u672a\u6267\u884c\u8be5\u81ea\u51cf\u8fd0\u7b97\u65f6\u7684i\u76f8\u7b49\u3002

\u6269\u5c55\u8d44\u6599\uff1awhile(1) \u8868\u793a\u65e0\u9650\u5faa\u73af\u3002
while\u7684\u8bed\u6cd5\u683c\u5f0f\u4e3a \uff1a
while(condition){//do something 1}//do something 2
condition \u4e3a\u5faa\u73af\u6761\u4ef6\uff0c\u6bcf\u6b21\u5224\u65adcondition\u662f\u5426\u4e3a\u771f\uff0c\u4e3a\u771f\u65f6\u6267\u884cwhile\u5faa\u73af\u4f53\u4e2d\u7684\u8bed\u53e5\u5757(\u4ee3\u7801\u4e2d\u57571)\uff1b\u4e3a\u5047\u65f6\u7ed3\u675f\u5faa\u73af\uff0c\u6267\u884c\u540e\u7eed\u8bed\u53e5\uff08\u4ee3\u7801\u4e2d\u57572\uff09\u3002
\u8fd9\u91cccondition\u4e3a1 \u8868\u793a\u6761\u4ef6\u6c38\u8fdc\u4e3a\u771f\uff0c\u4e00\u76f4\u6267\u884c\u5faa\u73af\u4f53\u5185\u8bed\u53e5\u3002\u4e3a\u4e86\u7ed3\u675f\u5faa\u73af\uff0c\u53ef\u4ee5\u5728\u5faa\u73af\u4f53\u5185\u6ee1\u8db3\u67d0\u4e9b\u7279\u5b9a\u6761\u4ef6\u4f7f\u7528break\u8df3\u51fa\u5faa\u73af\u3002
\u5982\u4e0b\uff1a
while(1){//do somethingif(condition){break;}}
\u53c2\u8003\u8d44\u6599\uff1a\u767e\u5ea6\u767e\u79d1-while

while
\u82f1\u6587\u53d1\u97f3\uff1a[waɪl]
\u4e2d\u6587\u91ca\u4e49\uff1aconj.\u5728\u2026\u671f\u95f4;\u5f53\u2026\u7684\u65f6\u5019;\u4e0e\u2026\u540c\u65f6
\u4f8b\u53e5\uff1a
Will you take care of my plants while I'm away?
\u6211\u4e0d\u5728\u671f\u95f4\u4f60\u53ef\u4ee5\u66ff\u6211\u7167\u770b\u82b1\u8349\u5417\uff1f
\u77ed\u8bed\uff1a
1\u3001after a while \u8fc7\u4e86\u4e00\u4f1a\u513f
2\u3001a little while \u4e0d\u4e45\uff0c\u4e00\u4f1a\u513f
3\u3001all the while \u4e00\u76f4\uff1b\u59cb\u7ec8
4\u3001quite a while \u6709\u4e00\u9635\u5b50\uff0c\u534a\u5929\uff1b\u76f8\u5f53\u957f\u4e00\u6bb5\u65f6\u95f4

\u6269\u5c55\u8d44\u6599
while\u7684\u7528\u6cd5\uff1a
1\u3001while\u7528\u4f5c\u8fde\u8bcd\u65f6,\u8868\u793a\u201c\u5728\u2026\u671f\u95f4\u201d\u3002\u5e38\u7528\u6765\u5f15\u5bfc\u65f6\u95f4\u72b6\u8bed\u4ece\u53e5,\u5f53\u4e3b\u53e5\u7684\u4e3b\u8bed\u548cwhile\u6240\u5f15\u5bfc\u7684\u4ece\u53e5\u7684\u4e3b\u8bed\u4e00\u81f4\u65f6, while\u4ece\u53e5\u4e2d\u7684\u4e3b\u8bed\u3001\u8c13\u8bed\u5f80\u5f80\u53ef\u4ee5\u7701\u53bb\u3002
2\u3001while\u8fd8\u53ef\u5f15\u5bfc\u8ba9\u6b65\u72b6\u8bed\u4ece\u53e5,\u610f\u601d\u662f\u201c\u867d\u7136,\u5c3d\u7ba1\u201d,\u542b\u6709\u5bf9\u6bd4\u610f\u5473\u3002
3\u3001while\u8868\u793a\u5bf9\u6bd4\u5173\u7cfb\u65f6,\u610f\u601d\u662f\u201c\u800c,\u7136\u800c\u201d\u3002

while(1) 小括号里,一般写逻辑表达式。

C语言广泛应用于底层开发。C语言能以简易的方式编译、处理低级存储器。C语言是仅产生少量的机器语言以及不需要任何运行环境支持便能运行的高效率程序设计语言。

尽管C语言提供了许多低级处理的功能,但仍然保持着跨平台的特性,以一个标准规格写出的C语言程序可在包括类似嵌入式处理器以及超级计算机等作业平台的许多计算机平台上进行编译。

C语言的运算符主要用于构成表达式,同一个符号在不同的表达式中,其作用并不一致。下面按计算的优先顺序,分别说明不同作用的表达式。需要特别指出,在C语言标准中,并没有结合性的说法。

相同优先级运算符,从左至右依次运算。注意后缀运算优先级高于前缀。因此++i++应解释为++(i++)。

而与或非的运算优先级都不一样,因此a && b || b && c解释为(a && b) || (b && c),合理使用优先级可以极大简化表达式。



条件判断永远为真,一直循环直到遇到break语句跳出循环。
如下例:
while(1){
scanf("%d", &a);
if(a == 1)
break;
}
不停地从标准输入读数赋给a,直到读到的是1就退出循环了。

判断条件永远为真,执行while语句,除非遇到break退出,否则死循环

n
1.一会儿
2.once in a while 有时,偶而
3.值得,有价值
conj
1. ...的时候
2.虽然,但是
vt
whiled,whiling 消磨,度过(与away连用)
adv
在...时候(前面与表示时间的词连用)

while(1)中的1代表true,所以执行while循环

扩展阅读:while 1 为什么只循环一次 ... c语言中while 1 的用法 ... while 0 是死循环吗 ... c语言while 0 什么意思 ... while 1 是无限循环吗 ... 如何跳出while 1 循环 ... 单片机while 1 什么意思 ... while 1 循环怎么跳出 ... c语言中while(1)是什么意思 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网