Go Back   Hardware Forums > Software Support Forums > Web Development

Reply
 
LinkBack Thread Tools
Old 14-06-2007, 12:14 PM   #1 (permalink) Top
Programmer
 
edijs's Avatar
 
Join Date: Sep 2006
Age: 22 Male
Posts: 523
Times Helpful: 16
My Mood: Busy
Status: Offline

My Computer

Default tricky thing

okay, um, can anyone tell me how one can exchange the values of two variables without using a temporary variable?

Send a message via Skype™ to edijs   Reply With Quote
Whats this? diNovo Media Desktop Laser
diNovo Media Desktop Laser
Seller Price (inc. VAT) Delivery Total Price Availability Seller Rating
Misco.co.uk £126.49 £3.99 £130.48 In Stock Rated: 4 out of 5 - Number of votes: 1355
Dell £128.69 Free £128.69 In Stock Rated: 0 out of 5 - Number of votes: 0
IT247.com £113.29 Free £113.29 In Stock Rated: 4 out of 5 - Number of votes: 38
Old 14-06-2007, 11:49 AM   #2 (permalink) Top
Programmer
 
edijs's Avatar
 
Join Date: Sep 2006
Age: 22 Male
Posts: 523
Times Helpful: 16
My Mood: Busy
Status: Offline

My Computer

not tricky after all...

Code:
Program 1uzd;

Var a,b:integer;

Begin

a:=1;
b:=2;

a:=a+b;
b:=a-b;
a:=b-a;


end.
apologees
Send a message via Skype™ to edijs   Reply With Quote
Old 14-06-2007, 12:53 PM   #3 (permalink) Top
The King

 
Addis's Avatar
 
Join Date: Jan 2004
Age: 18 Male
Posts: 5,255
Times Helpful: 403
My Mood: Drunk
Status: Offline

My Computer

Why would you want to do that? The C++ STL has swap() which is optimised for your architecture. I guess this one of those "Do it without the obvious way" things.
__________________
Never trust a program you don't have the source code for.

My website | Powerful Desktop Linux | Linux for human beings | Linux for power users | Linux for ricers
Send a message via MSN to Addis   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
best thing about HWF donkey42 General Chat 10 18-06-2006 10:33 PM
How hot will this thing get? Darcadian V1 CPU, Motherboards and Memory 4 06-11-2005 09:52 PM
Is this an XP thing?! beckw79 General Software 6 15-08-2005 09:46 AM
Tricky RAM problem Yuchao719 CPU, Motherboards and Memory 8 03-05-2005 10:28 PM
Is there such a thing for PCI wes321 General Hardware 5 21-01-2004 03:53 AM


All times are GMT +1. The time now is 08:34 AM.


Copyright © 2000 - 2008 · HARDWAREFORUMS.COM · All rights reserved