int i=5,j; j=i++ × i++; printf ("%d", j); what will be the output for this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

int i=5,j; j=i++ × i++; printf ("%d", j); what will be the output for this?

In C language, there is an increment operator. There is post increment and pre increment. How to use these?

17th Feb 2017, 12:11 PM
vyshnavi
vyshnavi - avatar
1 Answer
+ 2
using the pre-increment operator, the value ist first incremented then returned. using the post increment operator, the unchanged value is returned before the value is incremented. therefore the code returns 30 (one of both terms of the product is evaluated first, as post increment is used, the value returned is 5 before incremented to 6. 6 is returned on the seconde term before incremented to 7. 5x6 is 30)
17th Feb 2017, 7:23 PM
Cron