Answered step by step
Verified Expert Solution
Question
1 Approved Answer
make sure to have the same sentence in the output Compare Two Arrays Objective To practice using arrays to solve a problem. To use function
make sure to have the same sentence in the output
Compare Two Arrays Objective To practice using arrays to solve a problem. To use function and arrays Problem Define a function that compares two arrays and stores the positions where two array elements are different at into another array. For example, suppose two arrays have the following elements: D B B A A array 1[] A array2[]: A A B A A B A Then the following array, which is generated by the function, holds the positions where the two arrays are different at: diff* 2 5 7 Note that this array may not be fully filled up as the example shows! Test your function in a main program. The program should generate the following output: Array1 and Array2 are different in the following 3 positions: 2, 5, 7 Hint . The function should have four parameters: input array1[] and input array2[] and output diff[] and the number of elements in diff[] which is also an output from the function and may be less than the original array size (partially filled). 1/function definition void difference (char array1[], char array2[], int diff[], int& count) { for(int i=0; iStep 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