I've tried and tried to solve this problem, but I cannot do it. Here is the question:
Write the definition of a function, isReverse , whose first two parameters are arrays of integers of equal size, and whose third parameter is an integer indicating the size of each array. The function returns true if and only if one array is the reverse of the other. ("Reverse" here means same elements but in reverse order.)
Here is what I've tried:
My professor tells me it returns true for the first time, but what about the other timesCode:bool isReverse (int arr1 [], int arr2 [], int n) { for (int k = 0; k < n; k++) if (arr1 [k] == arr2 [n - 1 - k]) return true; else return false; }
This is the message the lab gives me:
It seems that your function fails to check the ends of the
arrays. Please revise your code.
I don't know what else to try. I would appreciate somebody's help, please!