Below is the code I made using memchr(); the problem is that it returns true only if the first when asked to search the first element, ie:
Code:setArray[] = { 1 2 3 }; and then I search for x=1 everything is fine but when searching for x=2 or x=3 it returns falseany ideas?Code:void Sets::membership( int x, int set ) { int size = (allSets[set]->size); if( memchr( allSets[set]->setArray, x, size ) == NULL ) cout << " No" << endl; else cout << " Yes" << endl; }