When element of character array is compared to "1" instead of '1' it shows an error
#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
return (a.second > b.second);
}
int main() {
int t;
cin>>t;
while(t--)
{
int N,K;
cin>>N>>K;
char s[N];
vector<pair<int,int>> zero;
int j;
cin>>s;
if(s[0]=='0') j=0; // No error when I use '0' instead of "0"
for(int i=1;i<N;i++)
{
if(s[i]=="1"&&s[i-1]=="0") zero.push_back(make_pair(j,i-j)); // [Error] ISO C++ forbids comparison between pointer and integer [-fpermissive]
else if(s[i]=="0"&&s[i-1]=="1") j=i;
}
if(s[N-1]=="0") zero.push_back(make_pair(0,N-j));
sort(zero.begin(),zero.end(),sortbysec);
for(auto i=zero.begin();i!=zero.end();i++)
{
cout<<i->first<<" "<<i->second<<endl;
if(K==0) break;
if(i->first==0)
{
K--;
zero.erase(i);
}
else
{
if(K>=2)
{
K-=2;
zero.erase(i);
}
}
}
int res=0;
for(auto i=zero.begin();i!=zero.end();i++)
{
res+=i->second;
}
cout<<res<<endl;
}
return 0;
}
[Error] ISO C++ forbids comparison between pointer and integer [-fpermissive] According to error one of them is pointer and other is integer if so then which of them is what and how?