C43 Answer


int allPresent( int arrA[], int sizeA, int arrB[], int sizeB );

/* Puzzle C43 -- check that two arrays have all elements in common
|
|   Every element in the first array must also be in the second array,
|   and every element in the second array must be in the first array.
|   However, there may be duplicate elements in either array.
|
|   Return 1 if the conditions are met; 0 otherwise.
|
*/
int allInBoth( int arrA[], int sizeA, int arrB[], int sizeB )
{
  if ( allPresent(  arrA,  sizeA, arrB,  sizeB ) != -1 )
    return 0;
  
  if ( allPresent(  arrB,  sizeB, arrA,  sizeA ) != -1 )
    return 0;
    
  return 1;
}