I am currently studying objective-c and the basic c programming language.
I have a questions about a particular line of code:
if (!balance)
If balance
is nil
then it will be a pointer to 0x0
. That address is never used for a valid object.
In C anything within an if
that evaluates to zero is considered a negative response, anything that evaluates to non-zero is a positive response.
Pointers evaluate to their address — exactly as if you cast them to an integral type. The !
means "NOT".
So the test is if(address of balance is not zero)
.