Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I just need the question labeled Project 4 but in order to do it, you will need to solve Project 3 and use it as
I just need the question labeled "Project 4" but in order to do it, you will need to solve "Project 3" and use it as a main first. Please use C language.
Project 3: Write a program that copies every third element in an input array to an output array and discards all the other values The program should include the following function: void decimate_by3 (int al[], int n, int a2[]) The function copies every third element in an input array all] of length n to an output array a20 and discards all the other values. (Hint: you might need the modulus (reminder) operator 96) Name your program copy 3.c. The program will read in the number of element of the array, for example, 4, then read in the numbers in the array, for example, 36 89 Assume the input array has three or more elements. In the main function, declare the input array after reading in the number of element of the array, then read in the elements, then calculate the length of the output array, and declare the output array, then call the decimate by3 function. The main function should display the output array 1) 2) 3) 4) Example input/output #1 Enter the length of the array: 8 Enter the elements of the array: 3 4 7 14 912 82 Output: 3 148 Example input/output #2 Enter the length of the array: 6 Enter the elements of the array: 3 4714 9 12 Output: 3 14 Project 4: Modify the program copy-3. c (project 3, #2) that copies every third element in an input array to an output array and discards all the other values to use pointer arithmetic in the decimate_by3 function. Modification: The decimate_by3 function should use pointer arithmetic- not subscripting- to visit array elements. In other words, eliminate the loop index variables and all use of the operator in the function. void decimate by3 (int *al, int n, int *a2) ; 1) Name your program copy 3_pointer.c 2) The main function should remain the same as project 3Step 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