Trouble with Help Function and (bool and if)

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)
			return false;
	return true;
}


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++;
		}
	}
sizeof(unique) / sizeof(unique[0])
This value is, most often, 1. You need to pass in the size of the array.

The function checks for existence, not unicity. I'm not sure if that's what you intended, but I doubt it.
Topic archived. No new replies allowed.