Question: Write a C++ function, which takes two integer arrays of equal length as input and compares them. The length of array can be also given
Write a C++ function, which takes two integer arrays of equal length as input and compares them. The length of array can be also given as an input parameter. If all the elements in the array are same, function should return 0. If elements are different, the function should return the first position where difference occurred.
Eg: If input arrays as [1,2,3,4] and [1,2,5,4] the function should return 2 since at position 2 first array has 3 and second array has 5.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
