In the statement,
i=i++ + f(i),
i++ is evaluated first. At this point i=0. The i passed to the function f()
has the value 1.
1 is printed in the function. 0 is returned. now the expression
i= i++ + f(i)
becomes
i=0+0
thus the value of i is changed to 0.
On Sat, Aug 6, 2011 at 8:29 PM, swetha rah
I guess the answer is that...i is post incremented..and in post increment
..increment occurs after the assignment operation
--
R@$!-!
"DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS."
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post
i guess it's because of the order in which execution of the statement takes
place
the function gets excecuted before the increment due to some reason i m
unaware of. sorry can't come up with a stronger reason
--
R@$!-!
"DoN'T LimIt Ur cHaLlEngeS, ChAlLenGe uR LImItS."
--
You received this messa
Hi,
class C{
static int f1(int i) {
System.out.print(i + ",");
return 0;
}
public static void main (String[] args) {
int i = 0;
i = i++ + f1(i);
System.out.print(i);
}}
Why does this print 1,0..?? Please explain...
--
You received this message because you are subscribed to the Google Gr