Question: C language programming 2. (50 points) Write a program that adds the first and last elements of an integer array and stored as the first

C language programming
2. (50 points) Write a program that adds the first and last elements of an integer array and stored as the first element of the output array, adds the second and second-to-last elements and stored as the second number, and so on. If the array has an odd number of integers, leave the central integer in the original array unchanged. Sample input/output #1: Enter the length of the array: 7 Enter the elements of the array: 3 5 8 4 1 39 Output: 12 894 Sample input/output #2: Enter the length of the array: 6 Enter the elements of the array: 2 6 13 4 17 Output: 9 7 17 1) Name your program arrays2.c 2) Include the following function compute() in the program: void compute(int *al, int nl, int *a2, int n2); al represents the input array with length nl, and a 2 represents the output array with length n2. The function should use pointer arithmetic, not subscripting - to visit array elements. In other words, eliminate the loop index variables and all use of the ll operator in the function. 3) In the main function, ask the user to enter the length of the input array, declare the input array, calculate the length of the output array, declare the output array, call the compute function, and display the output array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
