Home » C Programming » Operators » Question
  1. What is the difference between the following 2 codes?
    //Program 1
    #include <stdio.h>
    int main()
    {
    int n3, n1 = 2, n2 = 3;
    n3 = n1++ + ++n2;
    printf("%d %d %d", n3, n1, n2);
    }

    //Program 2
    #include <stdio.h>
    int main()
    {
    int n3, n1 = 2, n2 = 3;
    n3 = n1++ + +++n2;
    printf("%d %d %d", n3, n1, n2);
    }
    1. Space does make a difference, values of n1, n2, n3 are different
    2. No difference as space doesn’t make any difference, values of n1, n2, n3 are same in both the case
    3. Program 2 has syntax error, program 1 is not
    4. Program 1 has syntax error, program 2 is not
    5. None of these
Correct Option: C

Program 2 has syntax error, program 1 is not



Your comments will be displayed only after manual approval.