Well this is my problem, I wrote a function to sort a 2d char array but right now the second dimension bound cannot be variable so it has to be hardset (which I don't particularly like)
This is what I have
void multi_charSort(char array[][5])
{
int i,j;
char temp2[5];
for(i=0;i<5;i++)
{
for(j=0;j<i;j++)
{
if((array[i][0]>='A' && array[i][0]<='Z') && (array[j][0]>='A' && array[j][0]<='Z'))
{
if(array[i]>array[j])
{
for (int k=0;k<5;k++)
{
temp2[k]= array[i][k];
array[i][k]=array[j][k];
array[j][k]=temp2[k];
}
}
}
else if((array[i][0]>='a' && array[i][0]<='z') && (array[j][0]>='a' && array[j][0]<='z'))
{
if(array[i]>array[j])
{
for (int k=0;k<5;k++)
{
temp2[k]= array[i][k];
array[i][k]=array[j][k];
array[j][k]=temp2[k];
}
}
}
}
}
}
Output:
2d char Array initialized!
Printing char Array:
1: Shaw
2: Tom
3: Bill
4: Adam
Sorting charArray!
1: Adam
2: Bill
3: Tom
4: Shaw
Any suggestions? (I'm also not completely sure if this is sorting correctly)