hello, I need to write a bool function that checks if two 1D arrays of equal length are identical. I've written a seemingly straightforward loop to check that, however in practice, the program will always return whatever Boolean value is put in place after the if statement in the code bellow. I can't figure out where i'm going wrong and any help would be greatly appreciated. thanks in advance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
bool equalarrays(int a[], int b[], int n){
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if (a[i] != b[j])
{
returnfalse;
}
elsereturnfalse;
}
}
}