i = 3;
i = i++  +  i--;
out put would be 7.

game of operator precedence.



On Tue, Jun 8, 2010 at 12:30 PM, Manish kumar Singh
<[email protected]>wrote:

> Can any one explain what will be the value of 'i' after the statement
> i = 3;
> i = i++  +  i--;
>
> both in C++ and Java.
>
> On 6/8/10, cornerstone <[email protected]> wrote:
> > "So, the effect of the "++" is applied
> >> BEFORE the effect of the assignment"
> > dude it is not lyk dat post increment operator increments the d value
> > after the statement is executed and the complete statement ends after
> > dat semicolon here n here d statement is n=n++;
> > so the thing is dat the value of n is not incremented bfore d
> > execution of the whole statement is over.(as yew hav done in ur
> > explanation)
> > n=10;//ok
> > n=n++;//n holds now a value of 10 during the execution of this
> > statement and 11 after the execution of this statement
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "google-codejam" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-code%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/google-code?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-codejam" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-code%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-code?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to