Hi Ashwin & Paul,
I think the answer given by Paul is correct. But i have a different reasoning for that answer. Normally C process the data from right to left for eg:printf("%d %d %d ",x,x<<2,x>>2);
This behaviour is happens in majority of the cases but also from left to right processing is possible. Basically this direction of processing is guided by the way in which stack is implemented.
This behaviour is happens in majority of the cases but also from left to right processing is possible. Basically this direction of processing is guided by the way in which stack is implemented.
Regards,
S. Kumaran.
Paul Herring <[EMAIL PROTECTED]> wrote:
From: ashwin mittal [mailto:[EMAIL PROTECTED]
>From: amit
>> hi frnds,
>>
>> u will be getting the ans 5 , 20 and 1 . but the ans
>> given is in the format of 5,1 and 20.
>>
>> plz clear my doubt .
>>
>> i have one more doubt , from which side does the C
>> starts processing the data.i.e
>> suppose this is the statement given to u.
>> printf("%d %d %d ",x,x<<2,x>>2);
>> then it will first print the o/p of x>>2 then x<<2
>> and then x or x then x<<2 and then x>>2.
It works out all three values first, then passes these results to
printf() - there is no predefined 'order' in which these are called.
if x == 5 then
x<<2 == 5*2*2 == 10*2 == 20
x> >2 == (5/2)/2 == 2/2 == 1
>printf takes(processes) the argument from right to
>left which u urself have mentioned.
Not necesarily.
>and the answers
>is 5, 20 & 1.. It dispays the data in the same form in
>which it is demanded...
--
PJH
Quantum materiae materietur marmota monax si marmota monax materiam
possit materiari?
Alderley plc, Arnolds Field Estate, The Downs, Wickwar, Gloucestershire, GL12 8JD, UK
Tel: +44(0)1454 294556 Fax: +44 (0)1454 299272
Website : www.alderley.com Sales : [EMAIL PROTECTED] Service : [EMAIL PROTECTED]
This email and its contents are confidential and are solely for the use of the intended recipient. If you are not the original recipient you have received it in error and any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Should you receive this email in error please immediately notify [EMAIL PROTECTED]
This email has been scanned for viruses, however you should always scan emails with your own systems prior to opening.
To unsubscribe : [EMAIL PROTECTED]
Do you Yahoo!?
Jazz up your holiday email with celebrity designs. Learn more.
To unsubscribe : [EMAIL PROTECTED]
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To reply to this message, go to:
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4964
Please do not reply to this message via email. (more info)
- To visit your group on the web, go to:
http://groups.yahoo.com/group/Programmers-Town/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
