Simple syntax for mutiple && conditions when comparing two arrays

Hello,

Lets say i have two arrays myArray1 and myArray2 each with 3 elements
if i want to have the following condition

if ( myArray1[0] == myArray2[0] && myArray1[1] == myArray2[1] && myArray1[2] == myArray2[2] )

what would be a simpler syntax for that, this case is simple but what if i had two arrays with more elements?
thanks in advance
Last edited on
Well you could do something simple like this =]

1
2
3
4
5
6
7
8
9
bool isdifferent = false;
if (array sizes are equal)
for (int a = 0; a < (size of arrays); a++){
    if (array1[a] != array2[a]){
      isdifferent = true;
      break;
    }
}
//now isdifferent tells you whether or not the arrays are the same =] 
Topic archived. No new replies allowed.