Why is for(;;) used?

c, for-loop

Solution

It is the idiomatic way to have an infinite loop.

In the C Programming Language book, by Kernighan & Ritchie book it was introduced in section 3.5:

for (;;) {
    ...
 }

is an infinite loop, presumably to be broken by other means, such as a break or return.

Problem

I have seen code (in C) which contains something similar to: ``` for(;;){ } ``` How would this work, and why is it used in any instance?

Original source