Discover difference between nil and null, include the articles, news, trends, analysis and practical advice about difference between nil and null on alibabacloud.com
I. Brief description1.nil is used to assign values to objects (any object in objective-c is of type ID)2.NULL assigns any pointer, null and nil are not interchangeable3.nil for Class pointer assignment (in OBJECTIVE-C the class is an object and is
The problem is this.Nsdictionary *sample = [nsjsonserialization jsonobjectwithdata:received options:nsjsonreadingmutableleaves Error: &*messageinfo = [Sample objectforkey:@ "message"];Sample is a dictionary, Messsageinfo is obtained from the
We all know that nil, nil, NULL, nsnull are all empty but what is the difference, I believe that we have little attention. Today we're going to talk a little bit about the difference between these few empty1. NilNil generally refers to the empty
NIL: A null pointer to an object that assigns a null value to the objective C ID object.Nil: A null pointer to a class that represents a null value for the class.NULL: A null pointer to another type (for example, base type, C type) to assign a null
Nil: A null pointer to an Objective-c object.(#define NIL ((ID) 0))Nil represents a Objective-c object with a pointer to an emptyNil: A null pointer to an OBJECTIVE-C class.The first capital of nil and nil is a bit different, nil defines a pointer
I. Classes and objectsConcepts of classes and objects:1. A class is a highly abstract class that defines the static properties (attributes) and dynamic properties (methods) that this class of objects should have.2. An object is an instance of a
Nil, Nil, NULL, and NSNull in Objective C. nilnsnull
Kenyo's original statement is: the estimation of IOS development is a headache for Objective-C's memory management mechanism. Accidentally, the program will leak memory, and I am no exception, A
1.nil
>defines the ID of a null instance.
Defines an instance that is empty, pointing to an empty pointer to an object in OC.
> Sample code:
NSString *somestring = nil;
Nsurl *someurl = nil;
ID someobject = nil;
if (Anotherobject = = nil)//do
1.nil pointer to an object is empty the definition in objc.h is as follows:#ifndef nil# if __has_feature (cxx_nullptr) # define nil nullptr# else# define nil __darwin_null# endif#endifObject in objective-c for ID typeNSString *name = nil; Nsurl
1, nil and null from the literal meaning to understand the simpler, nil is an object, and null is a value, I understand that nil is to set the object to NULL, and NULL is the basic type is set to empty, the personal feel a bit like the attribute,
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.