Examveda
Examveda

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

This Question Belongs to C Program >> C Miscellaneous

Join The Discussion

Comments ( 6 )

  1. Fazle Rabbi
    Fazle Rabbi :
    4 years ago

    I am getting 45555. link: https://ideone.com/MXJt1K

  2. Youn Diny
    Youn Diny :
    6 years ago

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

  3. Pavan Kalyan
    Pavan Kalyan :
    7 years ago

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

  4. Sajid Khan
    Sajid Khan :
    7 years ago

    Ok the stack fact

  5. Shubh Tripathi
    Shubh Tripathi :
    7 years ago

    exactly how a could be the answer

  6. Sneha Arora
    Sneha Arora :
    7 years ago

    how option A is the answer?

Related Questions on C Miscellaneous