[cs631apue] Trouble sorting with qsort

Jan Schaumann jschauma at stevens.edu
Mon Sep 23 12:32:39 EDT 2013


Tejas Nadkarni <tnadkarn at stevens.edu> wrote:
> Nevermind, solved it :)
> 
> I moved the strcmp into a separate function and provided that to quicksort
> and it appears to work. My compare
> 
> int cmp (char **str1, char **str2)
> {
>   return strcmp(*str1,*str2);
> }

Good!  Having figured out what works and doesn't work is great; now do
you know _why_ it didn't work earlier?  Try to think it through and make
sure you understand.

-Jan


More information about the cs631apue mailing list