hey guys,
i am doin this program for sorting two-dimnsional aray in ascendin order, and it should accpt N inputs from user... whr N is 7
this is what i have done so far....
void sortLastNames(char name[][N], int N)
{
int count, count1;
char tempname[20];
for(count=0; count<N-1;count++)
{
for(count1=count+1;count1<N;count1++)
{
if(strcmp(name[count], name[count1])>0)
{
strcpy(tempname, name[count]);
strcpy(name[count], name[count1]);
strcpy(name[count1], tempname);
}
}
}
}
now problem is it runs smoothly if u enter input with upto 6 characters, if u enter more than that, it crashes....
please guys reply me back ASAP...
i am doin this program for sorting two-dimnsional aray in ascendin order, and it should accpt N inputs from user... whr N is 7
this is what i have done so far....
void sortLastNames(char name[][N], int N)
{
int count, count1;
char tempname[20];
for(count=0; count<N-1;count++)
{
for(count1=count+1;count1<N;count1++)
{
if(strcmp(name[count], name[count1])>0)
{
strcpy(tempname, name[count]);
strcpy(name[count], name[count1]);
strcpy(name[count1], tempname);
}
}
}
}
now problem is it runs smoothly if u enter input with upto 6 characters, if u enter more than that, it crashes....
please guys reply me back ASAP...
Last edited: