I have an assignment that requires me to write code that compares two arrays and confirms if every element in the first is equal to every element in the second. this is my code.
Code:
#include <stdio.h>
#define DIM 16
int main() {
int ndx, vals[DIM], vals2[DIM];
printf("Enter %d numbers: ", DIM);
for (ndx = 0; ndx < DIM; ndx++)
scanf("%d", &vals[ndx]);
printf("And another %d numbers: ", DIM);
for (ndx = 0; ndx < DIM; ndx++)
scanf("%d", &vals2[ndx]);
for (ndx = 0; vals[ndx] == vals2[ndx]; ndx++){}
if (ndx == DIM + 2)
printf("Equal\n");
else
printf("Not equal\n");
}
This code works (I came up with everything after the 2nd scanf). I get no compile errors and I pass all test cases. However, my professor's auto grader is not accepting it and it is not saying why. Can someone tell me what is wrong with my code? I don't see what it is. Thank you for your help.