Answer:
Following are the code in C++ language.
int integer,c=0 ;// variable declaration
int counter(int numbers[], size, integer) // function definition
{
for(int k=0; k<size; k++) // iterating over the loop
{
if (numbers[k] = integer) // check the condition value is found in the array
{
c++; // increment of count variable
}
return (c); // returns count
}
Step-by-step explanation:
Following are the description of the code.
- Declared a "integer" which is "int" type that indicating the value to be searched.
- Define a function "counter" which has 3 value in their function header array "numbers[]" , size of the array and the value which is to be searched.
- Iterating over the loop inside that for loop check the condition value is found in the array .
- If value is found in the array then it returns the number of counts.