Hi Guys,
So I have the functiom find_index_of_max and I need to use main as a driver to print the index of the the max value in the array. However, mine isn't functioning correctly. So, I was wondering if anyone can tell me what I need to do.
Thanks!
#include "Hw2Func.h"
int find_index_of_max(float *arr, int values_in_arr, float *max_value)
{
int index;
index = 0;
*max_value = arr[index];
for (index = 1; index < values_in_arr; index++)
{
if (arr[index] > *max_value)
{
*max_value = arr[index];
break;
}
}
return index;
}
#include <stdio.h>
int find_index_of_max(float [], int, float);
void strappend(char [], char []);
int main (int argc, const char * argv[])
{
printf("This is a test ... only a test.\n");
//variable definition
int arr[10] = {1, 22, 13, 5, 7, 10, 2, 9, 6 , 12};
int index;
printf("The Array :\n");
index = find_index_of_max(<#float [] #>, <#int #>, <#float #>);
printf("The index of the max number is : %f\n", index);
return 0;
}