@priya, Generally printf evaluation starts from left to right.... so first a++ using post increments assign the value of 3rd %d to be 2 then a++gets evaluated , now a value is 3 2nd %d takes a value as 3 1st %d takes a value as 3
if it is a preincrement like ++a in the third place the output will be 3,3,3... got it i guess... Thanks, Kartheek. On Sun, Jan 9, 2011 at 10:38 AM, priya mehta <[email protected]>wrote: > int a=2; > printf("%d %d %d",a,a,a++); > the output is 3 3 2 > can someone tell the logic behind this? > > -- > 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]<algogeeks%[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.
