The difference between using nil NULL Nsnull in iOS

Source: Internet
Author: User

the difference between nil NULL Nsnull is mainly the following points

1. Nil: General assignment to empty objects

2.NLL: A null value is generally assigned to a value other than nil. Into the SEL and so on.

3. Nsull:nsnull only one method + (NSNull *) null;

[NSNull NULL] used to add a non-nil (representing the end of the list) null value in Nsarray and Nsdictionary

4. Note: When you want NI to send the message, return no, there will be no exception, the program can continue to execute, and send a message to the Nsnull object will receive an exception

NIL:A null pointer to an OBJECTIVE-C object.

Nil is an object value.


NIL:A null pointer to an OBJECTIVE-C class.

To assign a null value to a class

NULL:A null pointer to anything else. (#define NULL ((void *) 0))

NULL is a null value, is for pointers, is valid for both object pointers and non-object pointers, and Null does not occupy space.

The difference between using nil NULL Nsnull in iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.