Home › Magazines › 2005 › July › Swapping without a Buffer

Swapping without a Buffer

-

Published in issue 345, July 2005

Most programmers will have their own library of commonly used snippets of code. One task that appears very often is the exchange of the contents of two variables. The code for this usually looks as follows:

int c;

c=a;
a=b;
b=c;

There doesn't appear to be anything wrong with this, but it does make use of a third variable and this takes up more memory.

Click below to download a PDF copy of this article from Elektor magazine.

 

Downloads 

PDF Article (054019-UK.pdf)
10 Elektor Credits
Please note. In view of the complexity of international markets, Elektor cannot guarantee the availability of components for this project.

Subscribe now

Subscribe to our free
E-weekly Newsletter!

Enter your Email address:

Follow Elektor

      

Act now!

Sponsored

FAQ

Before submitting questions, review our FAQ section!

Bestseller

Controller Area Network Projects

The aim of this book is to teach you the basic principles of CAN networks and in addition the development of microcontroller based projects using the CAN bus.

Package Deals

Elektor Bundles

Check our Package Deals and save money! Discounts up to 19% now available!

Price Slashed

Elektor OSPV

This Open Source People Vehicle is perfect for factory halls, warehouses, hospitals, colleges, schools etc.