please give me answer with details
#include<stdio.h>
main()
{
int i=1;
i=(++i)*(++i)*(++i);
printf("%d",i);
getch();
}
Answer Posted / joe
The precedence of the operations, should be (reading from
left to right in the equation)
++i <first ++i i=2>
++i <second ++i i=3>
* <first product yields 3*3=9>
++i <third ++i i=4>
* <giving the second product 3*4=36>
Thus, the first product (*) is computed before the third ++i
is computed. Once the first product is completed, i is
incremented to i=4 and the second product can occur now.
Now, if you add some parentheses to the expression giving
++i * (++i * ++i)
then you will get 64, as the other replies suggest. Tracing
through the order of operations in this one
++i <first ++i i=2>
++i <second ++I i=3>
++i <third ++I i=4>
* <the product in the parentheses now yields 4*4=16>
* <the first * yields 4*16=64>
Here, the first product (*) cannot occur until it knows the
result of the product in the parenthesis. Thus, all three
increments must occur before the multiplications take place.
| Is This Answer Correct ? | 13 Yes | 1 No |
Post New Answer View All Answers
What is const volatile variable in c?
What is a lvalue
write a program to print largest number of each row of a 2D array
Explain what is dynamic data structure?
What are global variables and how do you declare them?
what do the 'c' and 'v' in argc and argv stand for?
Explain zero based addressing.
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
Can you assign a different address to an array tag?
What is array of structure in c programming?
What is difference between arrays and pointers?
List a few unconditional control statement in c.
What is difference between stdio h and conio h?
How do I create a directory? How do I remove a directory (and its contents)?
What is an array? What the different types of arrays in c?