Created
June 5, 2013 22:47
-
-
Save pita5/5717926 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
- (void)swap:(id*)a with:(id*)b | |
{ | |
id c = *a; | |
*a = *b; | |
*b = c; | |
} | |
id a = @1; | |
id b = @2; | |
NSLog(@"a is %@",a); | |
NSLog(@"b is %@",b); | |
[self swap:&a with:&b]; | |
NSLog(@"a is %@",a); | |
NSLog(@"b is %@",b); | |
2013-06-05 23:45:46.548 App[26572:c07] a is 1 | |
2013-06-05 23:45:46.549 App[26572:c07] b is 2 | |
2013-06-05 23:45:46.549 App[26572:c07] a is 2 | |
2013-06-05 23:45:46.549 App[26572:c07] b is 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment