Purpose of while(1); statement in C

前端 未结 12 1632
终归单人心
终归单人心 2020-12-08 00:53

What purpose does while(1); serve ? I am aware while(1) (no semicolon) loops infinitely and is similar to a spinlock situation. However I do not

12条回答
  •  情歌与酒
    2020-12-08 01:04

    Since the condition is always true, we can say that we are using a logic tautology as known in mathematics. While the loop proofs to be always true it won´t stop looping unless forced by the code or until resources have collapsed.

提交回复
热议问题