ISO C++ forbids comparison between pointer and integer [-fpermissive]
if(S[i] == "#")
^~~
#include <iostream>
using namespace std;
int main() {
string S = "a#b#";
for( int i=0; i< S.length(); i++){
if(S[i] == "#")
//do somethng
}
return 0;
}
On googling this error i found a workaround to this by using '&' as in if( &S[i] == "#")
and it works fine. Can someone please enlighten me on why this works, what's happening here ?