Created
October 24, 2010 00:26
-
-
Save javiertoledo/642885 to your computer and use it in GitHub Desktop.
Classic variable swap in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Initializations*/ | |
int a,b,temp; | |
a=1; | |
b=2; | |
/*The classic swap code*/ | |
temp=a; | |
a=b; | |
b=temp; | |
/*Values have been happily swapped! (a==2 && b==1)*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment