Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 6 (18 points): complete the code Consider the function definition for st

ID: 3753398 • Letter: P

Question

Problem 6 (18 points): complete the code Consider the function definition for st retch below. If the function stretch is called on an array with the contents (1, 2, 3, 4), the array returned should have the contents (1, 1, 2.2. 3, 3,4, 4). So, it duplicates each member and keeps the order Complete the following function so that it: assigns new arr to malloc'ed memory with size for twice as many objects as arr with the original array length len * assigns the values of new arr as indicated above . returms new arr For example the following driver int mainO int SIZE-6 int arrt1-(1,2,3,4,5,6) int ret- stretch(arr, SIZE) for(int i-0: ic3IZE.2; i++) printf("ld"ret(41) tree (ret) return EXIT SUCCESS will return: 112233445566 // arr is an array of ints // len is the length of the array int stretch(int arr, int len) t if (ien 0) return NULL: /1 complete code here int new arr / end code here

Explanation / Answer

int *stretch(int *arr, int len) { if(len