#include #include #include #define TRUE 0 #define FALSE -1 int compare(const void *arg1, const void *arg2); void main(void){ int i; char ary[3][4], name[5]; printf("** TESTSORT **\n"); getchar(); memset(ary, 0, sizeof(ary)); strcpy(ary[0], "A002"); strcpy(ary[1], "A003"); strcpy(ary[2], "A001"); qsort((char*)ary, 3, 4, compare); for(i = 0; i<3; i++){ memcpy(name, ary[i], 4); name[4] = 0x00; printf("ary[%d] = %s\n", i, name); } getchar(); } int compare(const void *arg1, const void *arg2) { return (strcmp((char*)arg1, (char*)arg2)); }