Search code examples
c++strcmp

Compare two char variable using strcmp in c++ shows invalid conversion from 'char' to 'const char*'


This my code.

if(strcmp(s[0][i],s[rock][j])==0)
{           
     count[i]+=1;
     rock++;
}

Solution

  • The strcmp function compares two strings. If you want to compare two char variables, just use == or !=.