I want to know the difference between nil, NIL, and null.
I've googled around and found this:
nil -> null pointer to Objective-C object
NIL -> null pointer to Objective-C class
null -> null pointer to primitive type or absence of data
But I'm not able to understand the terms "Objective-C object" and "class" clearly.
Please explain this to me. Also, is there any word like NSNull or NSNil in Objective-C? If so, then please explain for what it is for.

nilis the literal null value for Objective-C objects, corresponding to the abstract typeidor any Objective-C type declared via@interface. For instance:Nilis the literal null value for Objective-C classes, corresponding to the typeClass. Since most code doesn’t need variables to reference classes, its use is not common. One example is:NULLis the literal null value for arbitrary C pointers. For instance,NSNullis a class for objects that represent null. In fact, there’s only one object, namely the one returned by+[NSNull null]. It is different fromnilbecausenilis a literal null value, i.e., it isn’t an object. The single instance ofNSNull, on the other hand, is a proper object.NSNullis often used in Foundation collections since they cannot storenilvalues. In the case of dictionaries,-objectForKey:returnsnilto indicate that a given key has no corresponding object in the dictionary, i.e., the key hasn’t been added to the dictionary. If you want to make it explicit that you have a certain key but it doesn’t have a value yet, you can use[NSNull null].For instance, the following throws an exception because dictionaries cannot store
nilvalues:On the other hand, the following code is valid since
[NSNull null]is a non-nilobject:It’s worth mentioning that Foundation collections have initialisers that use
nilas a marker for the end of a list of objects without having to specify the number of elements in the list. This can only happen becausenilcannot be stored in a Foundation collection. For instance,As for
NILorNSNil, there are no such things in Objective-C or Apple Foundation.