Quote Originally Posted by Salem
> So, I'd expect the function to work like:
> int count(int *array);
You mean like strlen() does
But that only works if there is some prior agreed value which marks the end of the array.
Of course, but void count(int *array, int *size) suffers the same restriction unless size contains the size of the array when you pass it to count() instead of being a placeholder that count() fills (which is the case for the OP).

But there are alternatives that come to mind. The function doesn't might not need to worry about the end of the array. Suppose you know for certain that every array you'll pass to the function has at least three 1 values in it. The function might loop through the array until it finds the third 1 value and then return the index of it.