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, b, c;
    a = b = c = 1;
    c = ++a || ++b && ++c;
    printf ( "a = %d b = %d c = %d\n", a , b, c);
    return 0;
    }
    1. a = 2 b = 1 c = 1
    2. a = 2 b = 2 c = 2
    3. a = 2 b = 2 c = 1
    4. a = 1 b = 2 c = 1
Correct Option: A

For given statement c = ++a || ++b && ++c;
only ++a will be evaluated so the output will be
a = 2
b =1
c = 1



Your comments will be displayed only after manual approval.