4 ms·
No, it's not an infinite loop. If fp comes back as NULL from the initializer part of the loop, then the for loop exits.
by oso2k 11y ago
No, it's not an infinite loop. If fp comes back as NULL from the initializer part of the loop, then the for loop exits.
- stouset 11y agoAnd if it doesn't come back NULL, it... immediately `fclose`s the pointer and sets it to zero.
- breadbox 11y agoImmediately after executing the loop body, you mean.
- baruch 11y agoUnless someone used continue inside that loop by mistake...
- deleted 11y ago[deleted]
- xamuel 11y agoUsing "continue" in that loop is harmless, it causes the file pointer to be closed and the loop to terminate. Calling "break" is more harmful though, as it would cause the loop to terminate without closing the file, a memory leak.