Let me start by saying I have only been at this for about two months, and had no idea what C++ was before that. I am confused about why the code below worked. It is a simple array filling function that fills an array with user inputed data:
//excerpt from main function
cout << " Enter " << ARRAY_SIZE << "integers: "; //ARRAY_SIZE = 10
fillArray(listA, ARRAY_SIZE);
cout << "After filling listA, "
<< "the elements are: " << endl;
printArray(listA, ARRAY_SIZE);
void fillArray(int x[], int sizeX)
{
int index;
for (index = 0; index < sizeX ; index++)
cin >> x[index];
}
void printArray(constint x[], int sizeX)
{
int index;
for (index = 0; index < sizeX; index++)
cout << x[index];
}
My question: How does the user input make it into the fillArray function? I dont see any variable to pass it into the input into the fillArray function.