Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello can you help solve this problem? Thank you 16.Consider the following array definition const int numbers [SIZE] { 18, 17, 12, 14 ); Suppose
Hello can you help solve this problem?
Thank you
16.Consider the following array definition const int numbers [SIZE] { 18, 17, 12, 14 ); Suppose we want to pass the array to the function processArray in the following manner processArray (numbers, SIZE Which of the following function headers is the correct one for the processArray function and why? a. void processAr ray(const int *arr, int size b. void processArray (int const arr, int size) 17.Write the definition of a function named getString that has a local char array of 80 elements. The function should ask the user to enter a sentence, and store the sentence in the array. Then the function should dynamically allocate a char array just large enough to hold the sentence, plus the null terminator. It should copy the sentence to the dynamically allocated array, and then return a pointer to the array. (Hint you will need atrien for getting the sentence length.) 18.Write the definition of a function that accepts an int array and the array's size as arguments. The function should create a new array that is twice the size of the argument array. The function should copy the contents of the argument array to the new array, and initialize the unused elements of the second array with 0The function should return a pointer to the new array 19.Write a function that accepts an int array and the array's size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer to the new array 20.Write a function that accepts an int array and the array's size as arguments. The function should create a new array that is one element larger than the argument array. The first element of the new array should be set to 0. Element 0 of the argument array should be copied to element 1 of the new array, element 1 of the argument array should be copied to element 2 of the new array, and so forth. The function should return a pointer to the new array 21.Write the definition of a function that accepts as arguments the following a. An array of integers b. An integer that indicates the number of elements in the array The function should determine the median of the array. This value should be returned as a double. (Assume the values in the array are already sorted.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started