Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   wat does +++ do??? (http://www.go4expert.com/forums/wat-does-do-t29295/)

IndiraP 17Nov2012 20:45

wat does +++ do???
 
Code:

main()
{
    int a=10,b=20,c;
    c = a+++b;
    printf("%d",c);
}

output is 30..

how does this work???

shabbir 18Nov2012 10:32

Re: wat does +++ do???
 
++ increments a and next + is an addition

IndiraP 18Nov2012 16:14

Re: wat does +++ do???
 
Quote:

Originally Posted by shabbir (Post 98236)
++ increments a and next + is an addition

yes sir...forgot dat was a post increment..
so a+b n then a is incremented..
thank u sir..:)

debugEnthu 28Nov2012 16:58

Re: wat does +++ do???
 
Just to add...
Maximum munch rule is follwed here.
ie: It uses
(a++ ) + b
instead of
a + (++b)

IndiraP 12Dec2012 02:21

Re: wat does +++ do???
 
Quote:

Originally Posted by debugEnthu (Post 98330)
Just to add...
Maximum munch rule is follwed here.
ie: It uses
(a++ ) + b
instead of
a + (++b)

thank u for the info..:)


All times are GMT +5.5. The time now is 09:25.