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


Please Help Members By Posting Answers For Below Questions

What is wrong with this statement? Myname = 'robin';

809


What is wrong with this program statement? void = 10;

808


any "C" function by default returns an a) int value b) float value c) char value d) a & b

656


What does the format %10.2 mean when included in a printf statement?

1075


What is pointer and structure in c?

557






Why is structure padding done in c?

635


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2258


What is a void pointer? When is a void pointer used?

614


Is r written in c?

717


What is wild pointer in c?

595


How do I convert a string to all upper or lower case?

619


What does malloc () calloc () realloc () free () do?

547


What is the explanation for modular programming?

672


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1656


pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)

1853