Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C programming question; i don\'t need the entire program, i just need the functi

ID: 3828697 • Letter: C

Question

C programming question; i don't need the entire program, i just need the function definiton!

Write a user-defined function called MatchCount that receives two parameters: an array of integers and an integer that contains the number of elements in the array. The function:

1. prompts the user for an integer

2, counts the number of times the integer appears in the array

3. returns the count.

Example: if array contains 6,7,3,1,5,6,2,5 and the user entered a 7, the function would return the number 1 since 7 appears 1 time in the array.

Explanation / Answer

FUNCTION DEFINITION

int MatchCount(int a[],int n)
{
   int f,count=0,i=0;
  
   printf("Enter a integer: ");
   scanf("%d",&f);
  
   for(i=0;i<n;i++)
   {
       if (a[i]==f)
           count++;
   }
  
   return count;
  
}