Checking if two arrays are equal

This tip submitted by Unnikrishnan T A on 2010-02-28 06:00:58. It has been viewed 4390 times.
Rating of 4.9 with 15 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;
for(i=0;i



More tips

Help your fellow programmers! Add a tip!