[Solved] Why is a=4 evaluated as true but b=0 evaluated as false in an if condition?


The assignment expression

x = n

evaluates to the value assigned to x. So a = 4 evaluates to 4, and b = 0 evaluates to 0. In C and C++, non-zero values are true, and zero values are false.

3

solved Why is a=4 evaluated as true but b=0 evaluated as false in an if condition?