Frequency Finder (Array)


/ Published in: C++



Copy this code and paste it in your HTML
  1. int findFreq(int myArray[], int key, int size)
  2. {
  3. int freq[10] = {0};
  4.  
  5. for(int i=0; i<size; i++)
  6. freq[myArray[i]]++;
  7.  
  8. return freq[key];
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.