So I'm trying to compare the values of these 2 arrays, and I created a test comparing each element of each array to each other. However I only want the printf statement to print once only if all the elements of each array are equal to each other.
This code prints the statement for each element that is equal, but I only need it to print once if all the elements are the same. What should I do?
int MatrixEqualsActual[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
int MatrixEquals[3][3] = {{3, 5, 9}, {1, 2, 6}, {9, 0, 1}};
int i, j;
for (i = 0; i < 3; i++) {
for (j = 0; j < 3; j++) {
if(MatrixEqualsActual[i][j] == MatrixEquals[i][j])
{
printf("PASSED (2/2): MatrixEquals()\n");
}
}
}