int i=0;
printf(“%d\t%d\t%d\t%d\t%d\t%d\t%d\n”,i++,++i,i++,++i,i,i++,i);
What will be the output? And how?
int i=0;
printf(“%d\t%d\t%d\t%d\t%d\t%d\t%d\n”,i++,++i,i++,++i,i,i++,i);
What will be the output? And how?
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
In case of printf always compute the output from right to left but print from left to right…
Second point to be noted while computing is that i++ is first printed immediately and then computed while in case of ++i, it is computed first and prints the final value of i in the end. i behaves similar to ++i in printing…
output will be
4 5 2 5 5 0 5