Multiple choice

Consider the following C statement: int i = 5, n = 2, z;z = (i! =n) || i>n && n; printf(z = %d,z); What would be the value of 'z'?

  1. z = 0

  2. z = 1

  3. z = garbage value

  4. Compiler error

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is the correct option as each part of expression is satisfied, i.e., i! = n is true, then i > n is true, and n has also non-zero value. Therefore, the value assigned to z would be 1.