Pregunta

Say I know the incoming string s only contain one character and i have a data type char c

When I do s == c, does c auto converts to a string type or the other way around?

¿Fue útil?

Solución

You can't do that, they are incompatible types. Something like this will work:

s[0] == c

Otros consejos

No you cant use s ==c as s would refer to the address so you should be using

s[0]==c 

hope it helped

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top