break statement doesn’t work in a loop [closed]

FWIW, if is a condition (selection statement, to be exact), and break works in a loop (iteration statement)/switch-case statement.

As per C11, chapter §6.8.6.3

A break statement shall appear only in or as a switch body or loop body.

In any case, you don’t need a break in a if statement body.

Leave a Comment