Created
November 13, 2014 12:49
-
-
Save anuradhawick/1a423202d3950d018aeb to your computer and use it in GitHub Desktop.
Reversing an array of characters 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
void reverse(char * array,int size){ | |
int i; | |
char a,b; | |
for(i=0;i<=size/2;i++){ | |
a = array[i]; | |
array[i] = array[size-i-1]; | |
array[size-i-1] = a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment