Checking if two arrays are equal

This tip submitted by Unnikrishnan T A on 2010-02-28 06:00:58. It has been viewed 8195 times.
Rating of 5.0 with 22 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!