Home / C Programming / Operators and Expressions :: Discussion

Discussion :: Operators and Expressions

  1. What is the output of the following statements?

    int i = 0;

    printf("%d %d", i, i++);

  2. A.

     0 1

    B.

     1 0

    C.

     0 0

    D.

     1 1

    E.

     None of these

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Since the evaluation is from right to left.
    So when the print statement execute value of i = 0
    Since its execute from right to left when i++ will be execute first and print value 0 (since its post increment ) and after printing 0 value of i become 1.
    So it its prints for 1 for next i.


Be The First To Comment