Skip to content

Instantly share code, notes, and snippets.

@alexfish
Created April 18, 2011 22:31
Show Gist options
  • Save alexfish/926390 to your computer and use it in GitHub Desktop.
Save alexfish/926390 to your computer and use it in GitHub Desktop.
Reverse an array in Objective-c
-(void)reverse {
int i = 0;
int j = [array count] - 1;
while (i < j) {
[array exchangeObjectAtIndex:i withObject:[array objectAtIndex:j]];
i++
j--
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment