Determine Output:
void main()
      int i=5;
      printf("%d%d%d%d%d", i++, i--, ++i, --i, i);

A. 45545

B. 54544

C. 55445

D. 54554

Answer: Option A

Solution(By Examveda Team)

The arguments in a function call are pushed into the stack from left to right. The evaluation is by popping out from the stack. and the evaluation is from right to left, hence the result. See the picture below
C Miscellaneous mcq solution image

Join The Discussion

Comments ( 5 )

  1. Youn Diny
    Youn Diny :
    2 years ago

    we are compile this question but answer is change and not given in options
    the answer we get 55555

  2. Pavan Kalyan
    Pavan Kalyan :
    3 years ago

    You are not using stack ,i am getting 45555 answer please respond

  3. Sajid Khan
    Sajid Khan :
    3 years ago

    Ok the stack fact

  4. Shubh Tripathi
    Shubh Tripathi :
    3 years ago

    exactly how a could be the answer

  5. Sneha Arora
    Sneha Arora :
    3 years ago

    how option A is the answer?

Related Questions on C Miscellaneous