how to check if two arrays are equal in c code example
Example 1: how to make two arrays equal in c
void Set::getData(Set& tempSet) const.
{
for (int i = 0; i < size; i++)
tempSet[i] = set[i];
}
Example 2: equal elements in two arrays in c++
bool equalelementsintwoarrays(int A[], int B[], int N) {
sort(A, A+N);
sort(B, B+N);
int i = 0, j = 0;
while (i < N && j < N) {
if (A[i] == B[j]) return true;
else if (A[i] > B[j]) j++;
else i++;
}
return false;
}