I recently decided to get back into playing with C++. Currently I am having a hard time running an integer array and integer through a helper function to check if the integer is unique in the array. If the value is unique, I am attempting to add it to the array. If not, I hoped to skip that value and go onto the next. It seems to completely skip the if statement in the help function but I can't figure out why. Any help would be much appreciated!
Helper Function:
1 2 3 4 5 6
bool uniqueCheck(int unique[], int num){
for (int i = 0; i < (sizeof(unique) / sizeof(unique[0])) ; i++)
if (unique[i] == num)
returnfalse;
returntrue;
}
Within int main():
1 2 3 4 5 6
for (int i = 0; i < FiveCount; i++){
if (uniqueCheck(UniqueMultiples, Fives[i])){
UniqueMultiples[ThreeCount + i] = Fives[i];
UniqueCount++;
}
}