Im trying to rank a class from least to greatest by average, but Im trying to switch the names along with them, but the names do not switch. Can someone help me out? Here is part of my code:
int i=0, j=0,test=0,n=20;
float tmp;
char tmp2[20];
for (i=0; i<n-1; i++) {
for (j=0; j<n-1-i; j++){
if (average2[j+1] < average2[j]) { /*****compare the two numbers ******/
tmp = average2[j]; /*****swap average2[j] and average2[j+1]******/
tmp2[j]=names_array[j][0];