This program is to find Frequency of different elements in array using unordered map. But I am unable to debug it, as this error is occuring for the first time in my code. Please help me debug this code.
#include<iostream>
#include<unordered_map>
using namespace std;
void frequency(int arr[] , int n)
{
unordered_map<int,int> m;
for(int x : arr) /* This line is showing error(for statement require a suitable begin function and none was found .)*/
m[x]++;
for( auto x : m)
cout<<x.first<<" : "<<x.second;
}
int main()
{
int n = 8;
int arr[n] = {10,12,10,15,10,20,12,12};
frequency(arr,n);
}