What type of data / basic data types iOS there?

Brief

When this paper to explore OC use iOS as a development language, we can use what data type.

 


Everything starts with the type C.

Type C language

Basic data types:

Basic data type (fundamental data types) also called primitive data types (primitive data types)

Integer, character, floating point, enumerated types

C data types and memory footprint

Enumeration inside the computer to store an int

In addition to basic data types, C as well as

Construction type:

Array type, type of structure (struct), common / Union type (Union)

union is generally used only for relatively small memory devices such as microcontroller programming.

Pointer type:

data_type *pointer_name

Since the address related to the pointer substantially (data_type independent of) the length of a CPU with memory address, memory address

So in the system 32, the pointer occupies 4 bytes; on 64-bit systems, the pointer occupies 8 bytes

Empty type (void):

Air is generally used type of function return value, means that no return any type.

Since the void type is just an abstract concept, and does not exist in memory, there is no natural bytes occupied.

 


With the class, things in the world Jieke definition.

OC language type

Because Objective-C is a strict superset of the C language, so the above data types are also OC data types.

Compared to C

OC is an object-oriented language, C ++ the same as the support of user-defined type (class) .

User-defined types birth Cocoa framework provides the possibility.

 


Type and more complex, the code more concise.

iOS Data Types

In general, we are talking about the type of data / basic data types refer to a language.

iOS data type Data type = C + Cocoa classes

iOS is not a strict data type is called, in fact, refers to a C data type plus Cocoa frame collection (Foundation, UIKit etc.) data type defined, i.e. Cocoa classes (refer to all run on Objective-C and when derived from the root class NSObject class).

Foundation framework NSObject class definition is the most important iOS data types, user-defined classes need to inherit from it to obtain the ability to call iOS system resources. There is also an important Foundation collection ( Collection) concept, which includes NSArray, NSSet, NSDictionarry and respective variable type; in addition, there is an important type NSString, NSMutabString, NSNumber like. The above-mentioned type are inherited from the NSObject, a user-defined type (class) and not constructed type (struct), which are assigned or when the function or method is passed, the value of the copy does not occur, but the conventional example transfer references.

to sum up

 

iOS Data Types

Note: As in iOS BOOL actually signed char type renaming, NSInteger, also similar, so they did not fall into a new type.

reference

C / elementary data type

C language, whether the size of the different types of pointer exactly, and why?

iOS Boolean

Memory: the stack and heap (C / Swift)

NSObjectNSNumber

Guess you like

Origin www.cnblogs.com/Free-Thinker/p/11101145.html