Explain pre increment and post increment operator with an example?

Answer:
  1. include<stdio.h>
    main()




{
int b=5;
int c= (b++) + (++b) + (++b) + (++b);
printf("%d",c);
}



Ans: The answer will be 29.


because
1st the value of b is 5


so in 1st b++ it will be 5(then will increment to 6)


so in 2nd ++b it will increment(b=6) value to 7.


and in 3rd ++b it will be 8


and in 4th ++b it will be 9


thus the final answer is 5+7+8+9=29...
-----

Although the above answer is correct but the approach is wrong i guess:
If you proceed according to your solution:
what will be the output for this:

x=5
y=++x * ++x;
printf("x=%d and y=%d",x,y);

?

Regards.
Note: There are comments associated with this question. See the discussion page to add to the conversation.
Contributor: Techsavy.ravi
First answer by ID2057791058. Last edit by Bagulsagar3790. Contributor trust: 0 [recommend contributor recommended]. Question popularity: 8 [recommend question].