My problem was over here: http://www.daniweb.com/forums/thread93806.html
After many advices, helps, I could eventually solve this problem myself, happy~~:D
All I did was to write a replacement function for strcmp() and then use a bubble sort function to sort input strings in lexicographical order.
Much simpler than nasty nested loops :P
my_strcmp():
int my_strcmp (char *str1, char *str2)
{
int id = 0;
char *temp1, *temp2;
temp1 = my_strlwr(str1);
temp2 = my_strlwr(str2);
while(!(id = *temp1 - *temp2) && *temp2)
{
++temp1, ++temp2;
}
if (id < 0)
{
id = -1;
}
else if (id > 0)
{
id = 1;
}
return id;
}
In fact, I got the realization from the source code algorithm. The important part is that I understand how this algorithm works now.