Question: C language programming Project 4, Program Design 1. (50 points) Write a program arrays1.c that checks if two integer arrays are different by one and

 C language programming Project 4, Program Design 1. (50 points) Write

C language programming

Project 4, Program Design 1. (50 points) Write a program arrays1.c that checks if two integer arrays are different by one and only one element when compared element by element (first element with first element, second with second, and so on) and displays the elements that are different. The program asks the user to enter the size of the arrays and then the elements of the arrays. Sample input/output #1: Enter the length of the array: 5 Enter the elements of the first array: -12 0 4 2 36 Enter the elements of the second array: -12 0 4 5 36 Output: The arrays are different by one element, 2 and 5. Sample input/output #2: Enter the length of the array: 4 Enter the elements of the first array: -12 0 4 36 Enter the elements of the second array: -12 0 4 36 Output: The arrays are NOT different by one element Sample input/output #3: Enter the length of the array: 5 Enter the elements of the first array: 5 0 4 2 36 Enter the elements of the second array: -12 0 4 5 36 Output: The arrays are NOT different by one element 1) Include and implement the following function in the program. Do not modify the function prototype. int one_element_different (int *al, int *a2, int n, int *elementi, int *element2); The function takes two integer array parameter al and a2 of size n. The function returns 1 if the two arrays are different one and only one element, returns 0 otherwise. elementi and element2 are integer pointers pointing to the variables in the main function that store the elements of the array 1 and array 2 where the elements are different. 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 l operator in the function. 2) In the main function, ask the user to enter the size of the arrays, declare the arrays, and then ask the user to enter the elements of the two arrays. The main function calls one_element_different function, and displays the result

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!