The first thing to understand is whether it is an if condition, a for condition or the condition of a do/while or while loop they all evaluate to a bool type result.
So it does not matter how "flag" is defined. either a "bool" or an "int" it still ends up as a bool meaning that (0) zero is false and (1) is true. Any result that is not (0) zero is considered true and changed to a 1.
To look at it another way if (flag) is a shorthand for if (flag == 1) and for if (flag == 0) you would use if (!flag).
Just like i++ is short for i = i +1 it is a way to better use what the language offers.