判断两个数组是否相等c++

介绍

模板不用多说,就是背。
注意:就是不能if(path==temp),因为这样只是比较的数组的起始地址。

源码

bool check(int path[], int temp[])
{
    for (int i = 1; i <= n; i ++ )
    {
        if (path[i] != temp[i]) return false;
    }
    return true;

}

版权声明:
作者:Reid
链接:https://www.ricemoon.cn/algorithm/tmplate/72.html
来源:RiceMoon
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
海报
判断两个数组是否相等c++
判断两个数组是否相等c++
<<上一篇
下一篇>>