alright i fixed it up, jus one little problem that i have no idea:
Code:
#include <stdio.h>
FILE * output =NULL;
FILE * input =NULL;
void display(float array[10])
{
int i;
for(i=0; i<10; i++)
{
fprintf(output,"%.4f ",array[i]);
fprintf(output,"\n");
}
}
float max(float array[10])
{
int i;
float max=0.0;
//for(i=0; i<10; i++)
//{
if(array[i]>max)
{
max=array[i];
}
//}
fprintf(output,"The maximum value is %f",&max);
}
int main(int argc, char * argv[])
{
int i;
float n;
float array[10];
output = stdout;
input = stdin;
for(i=0; i<10; i++)
{
fprintf(output,"Enter value ");
fscanf(input,"%f",&array[i]);
}
display(array);
//max(array);
fprintf(output,"%f\n",max(array));
}
Now the program is supposed to pass the array to the max module to find the biggest number, but doesnt work. if i put:
Code:
fprintf(output,"%f\n",max(array));
in the for loop in the main module it works, but once i put it outside like how it looks now it doesnt work, im not sure how to fix that?