21.07.2014, 18:30
The above posts explain the way the "not"-operator works, however to know why !strcmp does what you want, here is some extra info:
"!" makes the given value the opposite boolean. A boolean can only be true or false.
When an integer is cast to a boolean, "0"-integers are false and all other values are true. As "!" gives the opposite boolean, "!0" is true and "![any number]" is false.
strcmp -like the wiki says- returns 0 when the strings are exactly the same. therefore !strcmp(...) returns true when the two strings are exactly the same.
"!" makes the given value the opposite boolean. A boolean can only be true or false.
When an integer is cast to a boolean, "0"-integers are false and all other values are true. As "!" gives the opposite boolean, "!0" is true and "![any number]" is false.
strcmp -like the wiki says- returns 0 when the strings are exactly the same. therefore !strcmp(...) returns true when the two strings are exactly the same.