配列内の値の頻度を計算しようとしています。現在のエントリーは順調に進んでいると思いましたが、「カウント」を間違えているようです。アレイの周波数を正しく表示する方法についてセカンドオピニオンが欲しいです!これが私が持っているものです:
#include <stdio.h>
/************************************************************************/
/*                      Function: frequency                            */
/*                                                                     */
/*  Purpose:    Obtains the frequency of a number in an array          */
/*                                                                     */
/*                                                                     */ 
/*                                                                     */
/*  Parameters: theArray-The array in question                         */
/*              n- the size of the array                               */
/*              x- the number to search for frequency within the array */
/*                                                                     */
/*  Returns:    The frequency of a given number in an array              */
/*                                                                     */
/************************************************************************/
int frequency (int theArray [ ], int n, int x)
{
    int count = 0;
    int i;
    for (i = 0; i < n; ++i)
    {
        if ( theArray[i]=x)
        {
            count = count + 1 ;
        }      
        else
        {
            count = count ;
        } 
    }
      printf ("\nThe frequency of %i in your array is %i ",x,count);
  }
  int main ()
  {
      int i;    
      int theArray[] = {};
      int n;
      int x;
      printf ("Enter The Amount Of Numbers In Your Array: ");
      scanf("%i", &n);/*Stores Amound Of Numbers In The Array*/
      for (i = 0; i < n; ++i)
      {
          printf("\nEnter number for array: ");     
          scanf ("%i", &theArray[i]);
      }
      printf ("\nOK, Thanks! Now What Number Do You Want To Search For Frequency In Your Array? ");
      scanf("%i", &x);/*Stores Number To Search For Frequency*/
      frequency(theArray,n,x);
      return(0);  /* success */
  } /* main */