Your logic is flawed. You only test if the elements from A are present in B, not how many of each there are or if B has elements not present in A. Test your code with
Code:int A[]={1,1,1,1,2}; int B[]={1,2,2,2,2};Not equal, but your code says they are.Code:int A[]={1,1,1,1,1}; int B[]={1,2,3,4,5};