Infinite loop application - for(;;)

后端 未结 5 765
一生所求
一生所求 2020-12-22 03:29

I am trying to understand the concept behind the for loop example

for (;;)
{
//write code
}

I understand what it does and how it\'s the sa

5条回答
  •  猫巷女王i
    2020-12-22 03:56

    One perspective could be : While is more like event/condition based .. Where you run the loop until something happens which terminates the loop. On the other hand for loop is more like counter based where you want to specify for how many times should the loop happened. Al least it has an explicit provision for that.

    Ofcourse technically both are same they both check for run condition to start a loop cycle.

提交回复
热议问题