"Eric Sosman" <Er*********@sun.com> wrote in message
news:3F***************@sun.com...
SilverWolf wrote: char lines[100][100];
for (i = 0; i < count; ++i)
puts(lines[i]);
qsort (lines, count, sizeof lines[0], compare_func);
The first argument is the array to be sorted, the second is the
number of strings in the array, the third is the number of bytes
in each string,
While this is indeed the correct argument to use,
sizeof lines[0] will be 100, the size of each ("second
dimension") element of the array 'lines'. I'd say that
the number of bytes in each *string*, is determined by
strlen(lines[i]). I know you're probably trying to keep
things "simple", but imo this could lead to confusion
later.
To "SiverWolf": 'qsort()' needs to be told the size
is 100, since it cannot know how many of the 100 bytes
are actually part of the string (anything after the
first '\0' character is not part of the string).
Other than that, an excellent reply, Eric.
$.02,
-Mike