Checking if two arrays are equal

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