Login


CONTENT
View Current Issue
View Past Issues
Free Articles
eNewsletter Archives
Source Code
World's Best Authors
Site Search
MARKETPLACE
Subscribe
Online Store
CD-ROM Products
COMMUNITY
User Groups
Visual Basic Links
Calendar of Events
CAREERS
Job Bank
Salary Survey Results
CONTACT US
Contact Information
Advertising
Pinnacle Publishing Home
Pinnacle Publishing Home


Tip: Why Bother with Temporary Variables?

Chris Anderson

Here's a quick tip. I think the following code provides a good alternative that's both faster and uses less memory than the usual method of declaring a temporary variable and using that to swap the variables.

Public Sub SwapLong(ByRef lngFirst As Long, __
ByRef lngSecond As Long)
lngFirst = lngFirst Xor lngSecond
lngSecond= lngFirst Xor lngSecond
lngFirst = lngFirst Xor lngSecond
End Sub



Click here to learn more about Chris Anderson
 

 

To Contact Customer service: custserv@pinpub.com or call 1-800-788-1900
Copyright © 2001 Pinnacle Publishing, Inc. All Rights Reserved.