please give me answer with details
#include<stdio.h>
main()
{
int i=1;
i=(++i)*(++i)*(++i);
printf("%d",i);
getch();
}

Answers were Sorted based on User's Feedback



please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i..

Answer / 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

please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i..

Answer / gita

Answer is :64

Is This Answer Correct ?    7 Yes 7 No

please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i..

Answer / vaseem

++i * ++i * **i
->
2 3 4
now started this way
<-
4 * 4 * 4
=64

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More C Interview Questions

difference between my-strcpy and strcpy ?

3 Answers   Geometric Software, IIM, Infosys,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it?

3 Answers  


What are the uses of pre-processor directives?

2 Answers  


Explain what is the best way to comment out a section of code that contains comments?

0 Answers  


why little endian and big endian came?y they using differently? y they not used commonly ?wt is application of little and big ?

1 Answers  


How do you determine whether to use a stream function or a low-level function?

0 Answers  


What are runtime error?

0 Answers  


What are pointers? What are different types of pointers?

0 Answers   Fidelity,


What is 1f in c?

0 Answers  


Write a C program to print 1 2 3 ... 100 without using loops?

15 Answers   Hindalco,


Describe the modifier in c?

0 Answers  


Write a c program to build a heap method using Pointer to function and pointer to structure ?

0 Answers   MAHINDRA, Protech, Sivan Tech,


Categories