[EMAIL PROTECTED] wrote:
--- In [EMAIL PROTECTED], srikanth poojary
<[EMAIL PROTECTED]> wrote:
> main()
> {
> int i=5;
> printf("%d%d%d%d%d",i++,i--,++i,--i,i);
> }
>
>
> what is the o/p and why?
Hi,The o/p will be :
4,5,5,4,5
Finally the value of i will be 5.
This is becoz printf process from right to left.
printf("%d%d%d%d%d",i++,i--,++i,--i,i);
First the rightmost one : i =5
--i => 4
++i => 5
then i-- => first print i that is 5, then decrement,
i++ => first print i that is 4, then increment.
Hence, the final value of i=5.
Regards,
Kanaga
Output may be anything and it would be correct. See:
<http://www.eskimo.com/~scs/C-faq/q3.1.html> and the next few questions.
To unsubscribe : [EMAIL PROTECTED]
Yahoo! India Matrimony: Find your life partner
online.
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=4880
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.
