Checking if two arrays are equal

This tip submitted by Unnikrishnan T A on 2010-02-28 06:00:58. It has been viewed 9177 times.
Rating of 5.2 with 45 votes

When you compare two arrays, you must actually check for inequality since there is no atomic array comparison operation.

For example, notice the need to do a != in the code below:

bool equal = true;

More tips

Help your fellow programmers! Add a tip!