I'm trying to alphabetically sort my argv[] array, which will hold char pointers(strings) from the command line. This is my code, but it doesn't seem to be doing anything. Anyone see whats wrong?
Code:int sort_function( const char *a, const char *b) //this is the actual compare function! { return(strcmp(a,b)); } int main (int argc, char *argv[]) { qsort(argv, sizeof(argv), sizeof(argv[0]), sort_function); for (x = 1; x < 4; x++) printf("%s\n", argv[x]); }



LinkBack URL
About LinkBacks


