In this case,

i = 3;
i = i++  +  i--;

i=3
we have three statements to do
i = 3 + 3;
i++;
i--;

in this case, the assign is the last thing to do.


Consider this case,

int x,y;
int a=3;

 x = a++ + printf("value of a %d\n",a);+a-- +printf("value of a %d\n",a);;

x = 3 + 4 + 3 + 3 ;

printf("a%d x%d\n",a,x);

Output
value of a 4
value of a 3
a3
x16





Wladimir Araujo Tavares
"Fiz uma faculdade! Só não fiz a segunda porque acabaram os tijolos."




On Tue, Jun 8, 2010 at 4:12 AM, Kavakure Frank <[email protected]> wrote:

> manish;
>
> i = 3;
> i = i++  +  i--; //in this case i=6 since i++ equals 4 and i-- equals 2
>
> On 6/8/10, 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.
> >
> >
>
>
> --
>
> me: frank kavakure
> mail-me : [email protected]  | [email protected]
> call-me: (+257) 78-589-552 | 79-589-552 | 75-137-437
> skype-me: franqxx
> view-me: http://franqxx.appspot.com
>
>  I am currently waving on google: [email protected]
>
> --
> 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