+ 9

C logical AND & OR operator

Why when i use && operator value of z doesn’t change and when i use || operator change ?!! https://code.sololearn.com/cqG82HfrYSY7/?ref=app

17th Jul 2020, 12:39 PM
Ahmed Mahmoud
Ahmed Mahmoud - avatar
2 Respostas
+ 4
The expression after the && operator is not evaluated, because the first argument equals zero. „ 0 && anything“ is always false, so there is no need to calculate z++, so z remains 5.
17th Jul 2020, 12:49 PM
Michael
Michael - avatar
+ 4
thank u 🌺🌺
17th Jul 2020, 12:53 PM
Ahmed Mahmoud
Ahmed Mahmoud - avatar