Hi, I'm having a problem using pass by reference to pass arrays and floats through functions. This is my assignment:
http://www.comp.dit.ie/mcollins/ft22...signment2.html
The code I've got so far (which is pass by value as its all i can do):
How do I change this to pass by reference?Code:#include <stdio.h>
#define SIZE 5
main()
{
int i;
float temps[SIZE];
printf("\nPlease enter %d float numbers: \n\n", SIZE);
read(temps);
display(temps);
}
read(float temps[])
{
int i;
for (i = 0; i < SIZE; i++)
{
scanf("%f", &temps[i]);
}
}
display(float temps[])
{
int i;
for (i = 0; i < SIZE; i++)
{
printf("%f ", temps[i]);
}
}
Many thanks in advance.