When i
is 1, you print it with the printf
statement. Then i
gets incremented (via the ++
operator in your printf
statement). Then i /= 2
is performed, which results to i = 2 / 2
which results to 1
. This satisfies your condition i >= 1
, making it an infinite loop.
solved What output does the following for statement produce in C?