I would like to write a program that outputs real numbers in an array from the beginning to the beginning, and that shows the elements of the array and the maximum values in the array, but I couldn't do that with the program shown below.
I'm not sure what's wrong, so if anyone knows, please reply.
/* Store the entered real number data from the beginning of the array */
void readDoubleArray(inta[], int size)
{
inti;
for(i=0;i
The function that looks for the maximum value in double[]
will not work (compilation error) with int maxDoubleArray(inta[], int size)
.Because this function can receive int[]
but not double[]
.
Naming functions and variables is very important and sensible.Just by looking at the name, it would be nice to think that the function name and argument are inconsistent.
double maxDoubleArray(double a[], int size) {...}
Rewrite as shown in should work (untested)
# There are several other tsukkomi, but it doesn't seem to have anything to do with the main story, so it's short
© 2024 OneMinuteCode. All rights reserved.