Created
August 26, 2012 09:06
-
-
Save murikadan/3476448 to your computer and use it in GitHub Desktop.
Sorting a namelist implemented as an array of pointers
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 sort(char **w,int count) | |
{ | |
int i,j; | |
for(i=0;i<count;i++) | |
for(j=0;j<count-i-1;j++) | |
if(strcmp(w[j],w[j+1])>0) | |
{ | |
char *temp=w[j]; | |
w[j]=w[j+1]; | |
w[j+1]=temp; | |
} | |
} | |
/* | |
count is the number of strings in the string list | |
w is an array of charecter pointers | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment