title: Function to determine values matching a specific frequency in an array using for loops c++
body: <p>Apologies in advance for any obvious mistakes, I am not very skilled when it comes to programming. I am writing a program to determine the number of values in an array that occur at the exact frequency the user searches. For example, if the data set contains the numbers 5,6,6,7,7,8,9,9 and the user searches the array for a frequency of 2, because the numbers 6,7, and 9 all appear exactly 2 times, they match the frequency of 2, therefor the program would output that there are 3 numbers in the array that match the frequency of 2, and would list all of the values matching the frequency one time. Below is the function from my program that is supposed to perform this calculation but each time I run the program I get a value of 0 for values matching the frequency when there should be values appearing. The two for loops are a requirement for my function so I need those to work correctly as opposed to using a different method. I believe that some loops may need to be included inside others but I can't quite get it to fit. Any help fixing this function would be very appreciated.</p>
  
  <pre><code>short countOfFrequency (long data[], short dsize, long FreqNumbers[ ], short 
  Frequency)
  {
  
  short i, j;
  short count = 0;
  short Value;
  
  /*search above loop
  (loop searches above each element in the array, if an element of the same 
  value is found above the element, the loop terminates)*/ 
  for (i=0; i&lt;dsize; i++)
  {
      Value = data[i]; //the variable 'Value' is assigned to each element
      for (j=0; j&lt;i; j++)
      {
          break;
      }
  }
  
  /*search below + count loop
  (loop searches below each element in the array, if an element is found with 
  the same value, the variable 'count' is increased by one)*/
  for (j=i+1; j&lt;dsize; j++)
  {
      if (Value==data[i])
      {
          count++;
      }   
  }
  
  /*(If the count of a value matches the users desired frequency, that value
  is stored in the FreqNumbers array)*/ 
  if (count==Frequency)
      {
          FreqNumbers[dsize++] = Value;
      }
  
  return FreqNumbers[dsize];
  }
  </code></pre>