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
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What is the acronym for ansi?
What are the different types of pointers used in c language?
What is static and volatile in c?
Why do we need arrays in c?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
Which type of language is c?
Can we declare variable anywhere in c?
Explain what are linked list?
What is the use of getchar() function?
What is a rvalue?
Explain what is the difference between #include and #include 'file' ?
What are the primitive data types in c?
Explain modulus operator. What are the restrictions of a modulus operator?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.