Checking if two arrays are equal

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