seems I missed the define... weird. I was wondering where the swap function 
went.


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: [email protected]
My programs don't have bugs, they're called randomly added features.

----- Original Message ----- 
From: "peternilsson42" <[email protected]>
To: <[email protected]>
Sent: Monday, June 08, 2009 7:47 PM
Subject: [c-prog] Re: unpredictable OUTPUT????


"piyush_4love_4ever" <piyush_4love_4e...@...> wrote:
>   using TerboC/C++

http://www.borland.com/bcppbuilder/freecompiler/

>   # define swap(a,b)temp=a;a=b;b=temp;

http://c-faq.com/cpp/safemacros.html
http://c-faq.com/cpp/swapmacro.html

>    void main()

http://c-faq.com/decl/main.html

>    {
>    int i=5,j=10,temp=0;
>    if(i>j) swap(i,j);
>    printf("%d %d %d",i,j,temp);

7.19.2p2 "...Whether the last line requires a terminating
new-line character is implementation-defined. ..."

Add a \n.

>    }
>     output is 10 0 0.
>    [Unpredictable?????? pls help]

-- 
Peter


Reply via email to