I am trying to create a function that asks the user to enter a set of 10 numbers.
This function should fill my array with the values entered. The trick is doing it by using only functions and calling the functions inside main.
the function should have an integer array as its formal parameter.
Do I have to set a constant SIZE of the array to 10, since I want the user to input exactly 10 numbers?
Also where would I declare the array, inside main, or the function?
my prototype is currently set to this:
Code:
int getnumbers(int , int);
in the main I try calling getnumbers, but i get errors. I honestly am confused on how to scan the user input values and store them into the array.
and my function is this:
Code:
int getnumbers(int size, int input)
{
printf("please enter your list of numbers: ");
scanf( "%d", &input);
return input;
}