Question: The code so far is under the sample section. The int main() is complete and it calls the 3 function that already have the prototypes.
UllU USB pointer arithmetic to navigate them. 4 points for each function you complete. allocate STRATEGY The main function is provided. It will 1. declares a pointervariable (p and an integer variable called n. 2. calls function makearray to dynamically allocate an array assigned to p. of a random size (from 1 to 10 elements). Variable n contains the size of the The function returns a pointer that is assigned to p. 3. calls function fillarray0 that assigns random values between 1 and 10o to each element of the array using array element indexing. 4. calls function display to display all of the data in the array using pointer arithmetic Run your main program several times to demonstrate different sizes and random data. SAMPLE Here are the function prototypes with pre and post condition comments along with maino. Pre: none allocated Post an array of up to 10 elements is dynamically a pointer to that array is returned the size is assigned to reference parameter n int makearray (int& n) Pre: p points to an array of n integers Post: p is filled with random values from 1 to 100 void fillarray (int p, int n) Pre: p is an array of n integers Post: the contents of p have been displayed void display (int p, int n) int main int p, n; srand (time (0) p make array (n) cout "The size of the array is n endl; fillarray (p, n); display (p, n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
