Objective-C first day of study (BASICS)

Source: Internet
Author: User

Objective-c:

 

 

 

2.1.1-2.1.3 description

1. judging whether the memory of a variable is allocated to the stack gipo is a key method on the stack is to see if it is a pointer. A pointer is a variable pointing to a memory address.

 

 

2.1.4 use special variable modifiers.

Static keywords are considered as storage modifiers.

Const is similar to final in java

 

2.1.5 struct

Struct is represented by struct. To declare a struct, you must first tell the compiler struct itself, and then use this struct to declare a struct variable of the type already defined. The advantage of using struct is that it is a lightweight Method for storing variable groups, and struct has no overhead except for creating member variables that constitute it. Therefore, struct is sensitive to performance, not applicable to objects.

 

Struct can also contain struct, which is called composite struct.

 

2.1.6 type definition.

The type definition I understand is defined using typedef, and then we do not need to repeatedly define the structure we need to elaborate. You can use the type definition and struct together to better define a custom type to represent your struct .. Key Syntax: The typedef variable defines the new type name. Important

 

2.1.7 use enum

In java, the actual value of enumeration is determined by the compiler, but it is an integer by default. The first value is 0, the second value is 1, and so on.

You can use the type definition enumeration to avoid declaring enmu every time.

 

2.1.8 pointer:

A pointer is a variable that contains the address of another variable. The pointer operator is a (*). You can use the address operator (&) to obtain the address of a variable ,(*) the asterisk operator is also a pointer value operator. After the pointer value, you can access the value that the Pointer Points. In obj-c, you can regard an object as a pointer. At any time, you declare any object as a pointer.

 

2.1.9 use operators:

The related operation rules are the same as those in java.

 

2.1.10 three-object OPERATOR:

Same as java ,? :, Used to replace if/else

Related Article

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.