int arr[ARRAYSIZE];To send the entire array to the function f1(), the call would be:
f1(arr);The call of:
f2(arr[i])would only send one value to the function (the value at the i-th position in the array).
The call of:
f3(arr[]);would result in an error.
Inside of the function, the formal parameter declaration for an array would be:
void f1 (int arr []) { ... }Note: the size of the array is empty. This is because the array is already declared and the parameter is referring back to the original array. We normally will pass a second parameter to the function to inform the function how many positions the array is actually using. Take a look at the code in the file readfile1.cpp from lecture on Monday 3/3/2003
You may turn in the assignment to your TA during lab or place it in his mailbox in 905 SEO. It is suggested that you place it in his mailbox just in case you are unable to attend lab. You are to hand in a print out of your program to do the following to your TA.
Create a C++ program that will prompt the user of an integer value. Use this value to create an array with that many random values (i.e. if the user enters the value of 25, create 25 random numbers and store them in an array). You should create your array to hold a "goodly amount" of numbers (any where in the range from 100 to 1000). Do not use srand() with this lab, so the results can be duplicated if you run the program multiple times. You can set the random numbers to be in any range you would like. If the user enters a number greater than the size of the array, fill the entire array with random numbers and print some message stating that number entered is greater than the number of positions in the array.
After the random numbers are stored in the array. Call three functions that will:
Hand in a print out of your program to your TA.