I made a program that accepts up to and including 21 inputs of grade data and outputs the number of marks, the max and min, the standard deviation, and the letter grades. Thus, I made an array of size 21. Unfortunately, all of the loops in my program continue until array[i] != '\0', and I didn't know that 0 is equivalent to null, so it was originally quite broken for when people entered 0. To fix this problem, I said that if you enter 0, the array at that particular index instead is assigned 0.000001. This solved most of my problems, with the exception of my maxMin function, which for some reason still prints 0.000001 as the min mark. This function is seen below...
void maxMin() {
float min = array[0];
float max = array[0];
for (int j = 1; array[j] != '\0'; j++) {
if (min > array[j]) {
min = array[j];
}
if (max < array[j]) {
max = array[j];
}
}
printf("The highest mark is: %f \n", max);
if (min == 0.000001) {
printf("The lowest mark is: 0 \n");
}
else {
printf("The lowest mark is: %f \n", min);
}
}
How can I get this function to print 0 as the min mark?