Skip to content

Instantly share code, notes, and snippets.

@murikadan
Created August 26, 2012 09:06
Show Gist options
  • Save murikadan/3476448 to your computer and use it in GitHub Desktop.
Save murikadan/3476448 to your computer and use it in GitHub Desktop.
Sorting a namelist implemented as an array of pointers
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