The arguments in printf are evaluated from right to left.
first ++a gives 11 , then a is 11 and a++(bcoz postfix) is also 11
But the final value is copied to the prefix argument (++a) and just 'a'.
The postfix argument(a++) will retain the value it obtained.


On Sat, Jun 16, 2012 at 3:49 PM, rvkmr102 <[email protected]> wrote:

> If you evaluate the expressions from right to left and print the result
> from left to right , it will be clear.
>
> On Thursday, June 14, 2012 11:41:04 AM UTC+5:30, Ajesh js wrote:
>>
>> main()
>> {
>>     int a=10,b=5;
>>     printf("%d %d %d\n",a++,a,++a);
>>     printf("%d %d %d\n",++b,b,b++);
>> }
>>
>> output
>> 11 12 12
>> 7 7 5
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/rpQU8ga6Ev4J.
> 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/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" 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/algogeeks?hl=en.

Reply via email to