Příklad
void
foo(
char
*string1,
char
*string2)
{
if
(string1 == string2) {
}
}
Řešení
Pokud chcete zkontrolovat, zda byly řetězce stejné, můžete kontrolu zapsat, jak je uvedena níže.
void
foo(
char
*string1,
char
*string2)
{
if
(strcmp(string1, string2) == 0) {
}
}