Bcoz according to K & R , a single variables value can't be within one expression.
Soumya
Feb 5th, 2007
The answer is 56 because the compiler will use right to left associtavity here..
and when it gets i++
then for the value of i,
nothing happens..
then it gets *,
it puts it in stack..
then gets another i++
by this time the 1st ++ is executed and i's value is 8 now..
so it will be 8*7=56
purushottam
Oct 16th, 2011
49n
sourabh
Nov 7th, 2011
49
Md Moin Khan
Nov 11th, 2011
An output device is any piece of computer hardware equipment used to communicate the results of data processing carried out by an information processing system (such as a computer) to the outside world.
In computing, input/output, or I/O, refers to the communication between an information processing system (such as a computer), and the outside world. Inputs are the signals or data sent to the system, and outputs are the signals or data sent by the system to the outside.
Examples of output devices:
Since i=7
hence i++*i++=7+1*i++
=8*7++
=56++
=57
Since it is printf("%dn",i++*i++)
The output is 57n
mahamad
Apr 15th, 2012
Its 49n because compiler starts execution from right to left then it founds that ++i (remember,this is compiler execution) means it will take just 7 simply then again it founds that ++i (remember,this is compiler execution).
If u have any doubt then try the below code
int i=7;
printf("%d",++i*++i);
it will be 81
try it my friends!
The result will vary based on compiler and optimization settings, and in general is not predictable. The order of evaluation of expressions and the order in which side effects are applied is *unspecified*; you could get the result of 7*7, 7*8, or some other value. The language standard specifically calls this out as *undefined behavior*, so *any* result can be considered "correct". You should never write code like this.
64
i++=8
now i will be 8,8*8=64
after it increments to 9
nagesh
Dec 18th, 2012
56 bcoz ++ operator precedence is right to right.......
samantha
Apr 9th, 2013
i++=8
i++*i++=64
makesh
Jul 19th, 2013
Answer is: 49.
Because when I value leaves printf it gets incremented because its right ++(incremented)
wilson paul
Aug 27th, 2013
56
venugopal
Nov 1st, 2013
64
trisha biswal
Jan 11th, 2014
8*7=56
vikash kumar
Jan 15th, 2014
8*7
Bash
Sep 3rd, 2014
49
shailee
Sep 12th, 2014
7,64
Santhosh K
Sep 12th, 2014
i=7
so i++ * i++
7*7
49
priya
Dec 27th, 2014
error
Mrinal
Jan 12th, 2015
56
explanation:
i=7
i++ * i++
8 * 7 (after reading right most "i" the value gets incremented to 8, as we know that printf() reads from right.
estuti
Mar 5th, 2015
got the same question in my exam... the answer is very weird..should be 51..checked it on compiler. also
jfbode
Mar 8th, 2015
@estuti - if you took an exam that claimed this kind of an expression gave a specific, well-defined result, then the professor who wrote the exam doesn't understand how the language works. Any expression of the form x++*x++ invokes undefined behavior, and the result will vary based on platform, compiler settings etc.
Pradeep
Mar 23rd, 2015
Brother it is post increment
Sagar
Apr 20th, 2015
Initially i=7,
in printf statement (i++*i++)==>(7*8)=56
Finally, i turns to 9 (As simple as we are incrementing the i value twice the value turns to 9)
per-increment example:
int i=7;
printf(++i*++i)==> (8*9)=72
finally the value of i will be 9
Jagan
May 30th, 2015
8*9=72
Balakumar
Jul 15th, 2015
56
komal
Jul 19th, 2015
56
gaurav jain
Sep 16th, 2015
Answer is 56
Rupesh Ranjan
Sep 19th, 2015
63, its working something like that (i++*++i) = (7*9).
now your question is that why so? Because at first part of equation i++ = its 8 but not for itself its for another ++i = 9(because first it will take the incremental value of i = 8 and then increment it by 1 then its actual value if 9). and if in place of i++ is ++i and if in place of ++i is i++then the answer is 64 . Because same ++i = 8 and the i++=8 .++i is pre increment operator and i++ is post increment operator.
i++*i++ where i=7
post increment in this first use the value the update the variable
so first keep i=7 then increment its now i=8, this new value use by right is as use value, after its increment as 9
so expression is 7*8= 56 and after this instruction i value is 9.
What is the output? int i=7 printf("%dn",i++*i++);
Related Answered Questions
Related Open Questions