ok but the output of
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
is 22 13 14 14
howz that then?

On Sun, Jan 9, 2011 at 11:11 AM, kartheek muthyala
<[email protected]>wrote:

> Yeah you might be knowing how the expression evaluators work using stack
> right. printf also uses the same approach....
>
>
> On Sun, Jan 9, 2011 at 11:06 AM, priya mehta <[email protected]>wrote:
>
>> @kartheek so does it use stack for that?
>>
>>
>> On Sun, Jan 9, 2011 at 11:03 AM, priya mehta <[email protected]>wrote:
>>
>>> ok
>>> i got that
>>>
>>>   On Sun, Jan 9, 2011 at 11:01 AM, kartheek muthyala <
>>> [email protected]> wrote:
>>>
>>>> small correction printf evaluation starts from right to left.....
>>>>
>>>>
>>>> On Sun, Jan 9, 2011 at 10:59 AM, kartheek muthyala <
>>>> [email protected]> wrote:
>>>>
>>>>> @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]<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]<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]<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.

Reply via email to