IF CONDITION PROBLEM

Hi!

My problem is that I've to compare to string carecters and I've checked with Debugger that the condition is ok and the strings are the same, but the problem is that the program doesn't go into de 'if condition' altough its ok.

I leave you the code. Can somebody help me plis?

if(lequipos->equipo[i].jugador[j].nombre_jugador == nombre_jugador)
{
lequipos->equipo[i].jugador[j].dd = dd;
lequipos->equipo[i].jugador[j].mm = mm;
lequipos->equipo[i].jugador[j].aaaa = aaaa;
cont++;
}

Thanks byee

Is nombre_jugador a C++ string or a C string -char array- ?
char array
are you using Dev-C++ or visual C++????
visual c++
Use strcmp to compare C strings - notice that it will return 0 if the two strings are equal -
http://www.cplusplus.com/reference/clibrary/cstring/strcmp/
Thank you Bazzy! ;)
Topic archived. No new replies allowed.