Home » C Programming » Operators » Question
  1. Which of the following is the correct output for the program given below ?
    #include <stdio.h>
    int main ( )
    {
    int a = 12, b = 7, c;
    c = a != 4 || b == 2;
    printf ("c = %d\n" , c);
    return 0;
    }
    1. c = 0
    2. c = 1
    3. c = 4
    4. c = 2
Correct Option: B

Step 1: c = a != 4 || b == 2;
which is equivalent to c = TRUE || FALSE
or c = TRUE
i.e. c = 1



Your comments will be displayed only after manual approval.