Home » C Programming » Operators » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    void main()
    {
    int num1 = 10;
    int num2 = 11;
    num1 < num2 ? num1++ : num2 = num1;
    printf("%d", num1);
    }
    1. 10
    2. 11
    3. Runtime Error
    4. Compilation Error
    5. None of these
Correct Option: D

Compilation Error

main.c: In function ‘main’:
main.c:6:37: error: lvalue required as left operand of assignment
num1 < num2 ? num1++ : num2 = num1;



Your comments will be displayed only after manual approval.