Re: [algogeeks] Re: Can anyone plz explain how we get this output

2012-06-17 Thread Prem Nagarajan
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, rvkmr

[algogeeks] Re: Can anyone plz explain how we get this output

2012-06-16 Thread rvkmr102
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++); > }

[algogeeks] Re: Can anyone plz explain how we get this output

2012-06-15 Thread shiv narayan
although we know this is compiler dependent , but still such questions are very frequent in some local competitions and can be found in some old books too. is it possible to have such questions in any company placement paper or interview ? On Thursday, 14 June 2012 11:41:04 UTC+5:30, Ajesh js