Else
Look at this
main()
{
int a =10,b=20;
// swapping two variables
a=a^b;
b=a^b;
a=a^b;
}

Raj



>
-----Original Message-----
From: Paul Herring [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 30, 2004 3:39 PM
To: [EMAIL PROTECTED]
Subject: Review requested - swapping variable without a temporary
[c-prog]



From: Paul Herring
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
[...]
>>
>>Main()
>>{
>> int a =10,b=20;
>>// swapping two variables
>> a=a+b;
>> b=a-b;
>> a=a-b;
>>}
>
>And you appear to missed the posts pointing out that this does not work

>if (a+b)>MAX_INT
>
>Time to get an FAQ set up in the group pages I think. Starting to get
>sick of seeing this subject on various groups...

First draft - comments requested: <http://tinyurl.com/3zkbd>

--
PJH

"Consistently separating words by spaces became a general custom about
the tenth century A.D., and lasted until about 1957, when FORTRAN
abandoned the practice." -- Sun FORTRAN Reference Manual





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, send a blank message to
<mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links









To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to