WHY AM I GETTING ERROR: invalid type argument of unary '*' (have 'char')

#include
#include
#include
using namespace std;
void frequency(string s)
{
pair<char,int>f[1000];

int i=0;
for(; i<1000 ; i++)
{
f[i]=make_pair(’\0’,0);
}
i=0;
f[0].first=*s.begin();
f[0].second=0;

for(auto c : s)
{
 if(*c==f[i])
 {
	 f[i].second++;
 }
 else
 {
	 i++;
	 f[i].first=*c;
	 f[i].second++;
 }
}
pair<int , int >p;
p.first=0;

for(int j=0 ; j<i+1 ; j++)
{
if(p.first<f[j].second)
p.second=j;
}
cout<<f[p.second].first;

}//end

int main()
{
string s;
getline(cin,s);

sort(s.begin(), s.end()); 

cout << s;

frequency(s);
return 0;
}

//ERRORS: source.cpp: In function β€˜void frequency(std::string)’:
source.cpp:21:7: error: invalid type argument of unary β€˜*’ (have β€˜char’)
21 | if(c==f[i])
| ^
source.cpp:28:16: error: invalid type argument of unary '
’ (have β€˜char’)
28 | f[i].first=*c;
| ^

@amangupta
c is of the type char here. So *c is not correct thing to use.
auto just assign the datatype which is needed, so here it is β€˜char’.

Also if you have some more in doubt in then please provide the ide link of code.
Otherwise if now clear then please mark this doubt as resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.