I need to sort an array of stings alphabetically. The trouble is I have no idea how to do that. I need it to be case insensitive. My professor reccomended using toupper() with he built in string comparison so essentially I should turn [jon, Sally, ReBBa] into [JON, SALLY, REBBA] then compart them, sort them and then somehow return [jon, ReBBa, Sally] but I'm not sure how to do that. Any help would be greatly appreciated.
That snippet works for an array of ints, now you need it to work for an array of strings.
Line 1: array[] needs to be of type string instead of int
Line 4: minValue should be removed from here, because the values are strings, not ints
after Line 4: declare a string called minValue to replace the one you just removed
Line 13: call toupper on each of the things you're comparing before you actually compare them: if (toupper(array[index]) < toupper(minValue))
You might start with a function to compare two strings and determine which comes first according to your requirements. Once you've done that it is a simple case of retooling your sort function to work with strings, the biggest part of which is using the comparison function you just created to replace the less-than comparison on line 13.