passing arrays to a function
I am having a problem with how to pass the data collected in one function as an array to the next function.
I collected the amount of items with my first fuction as follows:
void input_items ( int item[], float amount[], int n)
{
/* declaration of local variable */
int count;
/* promt for amount according to item using loop*/
for (count = 0; count <= n - 1 ; ++count)
{
printf ("Enter total of each item you want %i ", item[count]);
scanf ("%f", &amount[count]);
}
}
in my next function I want to take the amount of each item and multiply it by the item cost. But the problem I am having is with how do I pass the amount of each item collected in the input_items function to the next function used in the program.
Do I need to return if I want to pass it to another function? I thought you didnt have to return anything if you passed it by reference. I am not sure of the syntax to pass it by reference.
caws