|
-
Aug 25th, 2000, 03:17 PM
#1
Thread Starter
Fanatic Member
Most highly trained and skilled professors, programmers, text books, etc. claim that to swap two variables, A and B, so that A contains B's value and B contains A's value, you need a third temporary variable, C.
Code:
Dim a As Integer
Dim b As Integer
Dim c As Integer
Let a = 10
Let b = 20
'
' Swap them...
'
Let c = a ' c is 10
Let a = b ' a is 20
Let b = c ' b is 10
Now, if you guys are so smart, then let me say this: There is a way to swap the two variables WITHOUT a third variable. Can anyone figure out this little riddle?
If you want a hint, wait for a few days, and I will post it.
Let's see how clever you all are.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|