mercredi 21 avril 2021

C++ comparing string with char*? [duplicate]

Note: args is vector of strings

My C++ code is behaving really strange, I am trying to compare string with string like this:

if (args[1].c_str() == "kill") 

even though args[1]="kill" still my code goes to else, why is that?

Here is a proof:

enter image description here

Aucun commentaire:

Enregistrer un commentaire