Hello, im quite new to C so sorry if this seems tedious.
Im trying to pass an array from a function back to main but it doesnt seem to work, it displays just zeros. Would be really grateful if someone could point me in the right direction.
Thanks
Code:
#include<stdio.h>
#include<stdlib.h>
float get_values (void);
float sum(float );
void mean (void);
void maximum_value(void);
int i;
main(void)
{
float v;
v= get_values();
for(i = 1; i<=5; i++){
printf("\tnumber %d = %f\n",i, v);
}
system("pause");
return(0);
}
float get_values(void)
{
float values[5];
printf("Enter 5 numbers\n");
for( i = 1; i <= 5; ++i ){
scanf("%f", &values[i] );
}
return values[i];
}