Question: Study and complete arrCopy.c so it prints out the following sample result in the same format. You must only insert code in the segments where

Study and complete arrCopy.c so it prints out the following sample result in the same format. You must only insert code in the segments where //Your code here is labeled. Contents of all arrays must be accessed through pointers, so you must not use any array notation [ ] in the code. Hint: Use dynamic memory allocations! Sample result (input is in italic and bold): Enter size of array: 5 Enter array content #1: 1 Enter array content #2: 3 Enter array content #3: 5 Enter array content #4: 7 Enter array content #5: 9 printArr: 1 3 5 7 9 printArr: 1 3 5 7 9

#include #include

void printArr(int *a, int size){ //Your code here }

int* arrCopy(int *a, int size){ //Your code here }

int main(){ int n; int *arr; int *arr_copy; int i; printf("Enter size of array: "); scanf("%d",&n);

//Dynamically create an int array of n items //Your code here

//Ask user to input content of array //Your code here /*************** YOU MUST NOT MAKE CHANGES BEYOND THIS LINE! ***********/ //Print original array printArr(arr, n);

//Copy array arr_copy = arrCopy(arr, n);

//Print new array printArr(arr_copy, n);

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!