#include <stdio.h>

int main(void) {
	// **************************************************
	// Function: frequency
	//
	// Description: Calculates the frequency of an item x
	// in an array with n elements.
	//
	// Parameters: theArray - array being checked
	//	       n - the number of elements in the array
	//		   x - the item being counted in the array
	//
	// Returns:    area - area of sector
	//
	// ***************************************************
	int anArray[7] = {5, 7, 23, 8, 23, 67, 23}; 
	
	int frequency (int theArray[], int n, int x)
	{
	    int frequency; /* how many times n is found */
	
	    frequency = 0; /* initialize count */
	
	    /* loop through every element in theArray */
	    for (int i = 0; i < n; ++i)
	    {
	        /* TODO - if the element x is found, increment frequency */
	        if (theArray[i] == x)
	        {
	        	frequency++; 
	        }
	 
	    }

    return frequency;
	}
	
	printf("%i", frequency(anArray, 7, 23));
	
	return 0;
}
