Mr_Appleby
Member
edit: eyes deceived me, nvm.
this line:
printf("Lowest Pressure: %f Lowest Temperature: %f\nHighest Pressure: %f Highest Temperature: %f\n", pressure[1], temp[1],pressure[10], temp[10]);
should be:
printf("Lowest Pressure: %f Lowest Temperature: %f\nHighest Pressure: %f Highest Temperature: %f\n", pressure[0], temp[0],pressure[10], temp[10]);
since C arrays are 0-indexed, meaning the first element is element 0. So eg. my_array[0]...my_array[9] is an array of size 10.
although I think sorting the arrays is overcomplicating the solution. you're only being asked to display the lowest and highest values which you can do with a simple for.. loop, overwriting a variable like "highest_temp" each time a new highest is encountered. etc. for lowest (you could do this in the same loop even)
this line:
printf("Lowest Pressure: %f Lowest Temperature: %f\nHighest Pressure: %f Highest Temperature: %f\n", pressure[1], temp[1],pressure[10], temp[10]);
should be:
printf("Lowest Pressure: %f Lowest Temperature: %f\nHighest Pressure: %f Highest Temperature: %f\n", pressure[0], temp[0],pressure[10], temp[10]);
since C arrays are 0-indexed, meaning the first element is element 0. So eg. my_array[0]...my_array[9] is an array of size 10.
although I think sorting the arrays is overcomplicating the solution. you're only being asked to display the lowest and highest values which you can do with a simple for.. loop, overwriting a variable like "highest_temp" each time a new highest is encountered. etc. for lowest (you could do this in the same loop even)