c - selection sort algorithm for 2d char array -


i trying make selection sort algorithm 2d array in c (as title says), code compiles unfortunately not sort anything.

is there can change make work? or have start on together?

void sortstrings(char strings[5][32]) {     int i, j, min;     (i = 0; < sizeof(strings); i++){         min = i;         (j = 0; j < sizeof(strings-1); j++){             if (strings[i] < strings[min]){                 min = 1;             }         }         if (min != i){             swapstrings(strings[i], strings[min]);         }     } } 

also here swapstrings function reference:

void swapstrings(char string1[], char string2[]) {     char *temp = string1;     string1 = string2;     string2 = temp; } 

sizeofreturns size taken in memory parameter. in case, size of char isn't size of array. can size of string using strlen function. however, can't size of array stringsyou need add parameter function.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -