/* Tanel Toova * 3-4 * Kommenteeri kood */ #include #include #define NUM_OF_ELEMENTS 4 char *pszArray[NUM_OF_ELEMENTS]={ "Särk", "Pikk-pikk-pikk-piiikkkkk string", "Värk", "Veel üks string" }; char *pszIdx[NUM_OF_ELEMENTS]; //this is the array where qsort puts sorted strings void output(void *pfSort) //*pfSort points to the function qsort is going to use to sort the pszArray { int i; char **ppszArray; //This array is used to display the sorted strings if(!pfSort){ //if pfSort is NULL then pszArray is not sorted ppszArray=pszArray; } else{ qsort(&pszIdx[0], NUM_OF_ELEMENTS, sizeof(char*), pfSort); //qsort sorts the array pszIdx by using function pointed by pfsort ppszArray=pszIdx; } printf("\n"); for(i=0;i