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).Originally Posted by Salem
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.