else if((int*)ch[j][l]==(int*)ch[j+1][l])
                    }       goto repeat;



    return 0;

NOt gettin any output

Edited 4 Years Ago by mike_2000_17: Fixed formatting

That's a very odd sort block of code. I'd dump it. Here's an easy one (this is substitution sort and should be used for small and medium sorting jobs).

Where SIZE is the size of the array with data you need sorted
where i and j are integers
where you have a 2D string array[SIZE][30]; //approx. on the 30
where you have a 1D char array[30]; //holds just one name at any time

for(i = 0;i < SIZE-1; i++) {
  for(j = i+1; j <SIZE; j++) {
    if((strcmp(array[i], array[j])) > 0) { //out of order?
      strcpy(temp, array[i]); //to temp
      strcpy(array[i], array[j]); //j to i
      strcpy(array[j], temp); //temp to j
printf("\nIn sorted order:\n");
for(i = 0; i < SIZE; i++) 
  printf("%s\n", array[i]);

This will sort according to the ASCII values (OK, the character set values you have on your system, but normally they're the same as ASCII values.

This is not exactly the same as a lexicographic sort (like the Dictionary). Close, but not quite the same.

This article has been dead for over six months. Start a new discussion instead.