strcmp // !strcmp
#6

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.
Reply


Messages In This Thread
strcmp // !strcmp - by elirand21 - 21.07.2014, 18:02
Re: strcmp // !strcmp - by Isolated - 21.07.2014, 18:03
Re: strcmp // !strcmp - by AroseKhanNiazi - 21.07.2014, 18:04
Re: strcmp // !strcmp - by Scaleta - 21.07.2014, 18:13
Re: strcmp // !strcmp - by Ihateyou - 21.07.2014, 18:15
Re: strcmp // !strcmp - by ikkentim - 21.07.2014, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)