Well I have an assignment in which I need to first ask a user for an amount of names to input, allocate the memory needed for the amount of strings, then sort them by the choice of the user with either last, first, or middle.
names are entered in format
last,first,middle

I did all the first part of the program.. I would put up my code but Im doing it all on a different machine ;P.

anyway I can sort by last name, and I had sorting by first name working for a bit, then the middle started crashing the program when I entered in a 3 to show i wanted to sort by middle name. after that the first name no longer worked.

ill try to post off what i remember of what i did.

the user inputs into num for number of strings
and i had names as the array for strings...

z = 0;
a = 0;
while(names[y][z] != ',')
z = z + 1;
while(names[y+1][a] != ',')
a = a +1;
if(strcmp(&names[y][z], &names[y+1][a]) < 0){
strcpy(temp1,names[y]
strcpy(names[y],names[y+1]);
strcpy(names[y+1],temp1);
}
this was all in 2 for loops, 1 to makes sure all the names get sorted, and the second with variable y, to go thru all the values of names..

anyway i think this was working, if someone sees some errors help me out

for the last name. i just cheat and use same code except it looks like
while(names[y][z] != ',')
z = z + 1;
z = z + 1;
while(names[y][z] != ',')
z = z + 1;
so now i think it should go thru both commas... but it wasn't working so i guess not... i used a compiler with debug mode and it said the program got z up to the value of like 29120 or 21920.. something like that then the program closed with an error message always.

oh, btw if someone comes along with super more efficient way, help out by all means.. i was thinking of breaking up a names[y] into like.. first_name, middle_name, last_name then comparing only first_name and middle_name, or last_name with names[y+1], but i wasn't sure on how i oculd go about doing this.

thanks in advance