Homework question- help?

Here is the question: Assuming int numbers[SIZE];is initialized somehow, write a function counter() that you can send the array to, plus an extra integer, and the function will return the number of times that value is found in the array. For example, if the array of SIZE 7 contains {1,2,3,2,3,3,3} then the call
x=counter(numbers,SIZE,3);will put 4 into x.

I want to do something like this:
int count = 0;
int counter(numbers, integer){
for(int i=0; i<SIZE; ++i)
if numbers[i] = integer{
count++;
else
cout << count;
return count;
}
try this

int count = 0;
int counter(int numbers[], arraysize, integer)
{
for(int i=0; i<arraysize; i++)
{
if (numbers[i] = integer)
{
count++;
}
return count;
}
Topic archived. No new replies allowed.