You are viewing a single comment's thread. Return to all comments →
c with frequancy array
int frequancyarray2(int arr_count, int* arr){ int max= 0 , maxvalue ; int * data = (int*)calloc(6 , sizeof(int)); for(int i = 0 ; i <= 5; i ++){ data[i]=0 ; } for (int i = 0 ; i < arr_count ; i ++){ data[arr[i]] ++ ; } max = data[0]; maxvalue= 0 ; for (int i = 1 ; i <= 5 ; i ++){ if (data[i] > max){ max = data[i] ; maxvalue = i ; } } free (data); return maxvalue; }
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
c with frequancy array