ios-(3) keywords, identifiers, comments

Source: Internet
Author: User
Tags switch case

First, the warning before learning grammar

1, C language belongs to a high-level language, in fact, all high-level language of the basic grammatical components are the same, but the form is not the same.

2, like Asians and Africans, we all have a human structure: Two hands, two feet, a head, but their appearance is not the same, such as skin color, face shape.

3, therefore, you have mastered a high-level language, and then to learn other high-level language, it is quite fast.

4, and, many other high-level language, OBJECT-C, etc., are based on C language, derived from the C language, good learning C language, absolutely not suffer.

Second, the key word

1. What is a keyword

* keyword is the C language provides a special meaning of the symbol

* The C language provides a total of 32 keywords, these two shoes keywords are given special meaning by C language

Auto double int struct break else long switch case enum register typedef char extern return Union const F Loat Short unsigned continue for signed void default goto sizeof volatile does if while static

2, the characteristics of the key words

* All are lowercase

* Special colors are displayed in the development tool or the Smart Text Editing tool. By default, keywords in the C language are displayed in Xcode with Violet-brown

3. What are the key words in the main function

* INT return

Third, identifiers

1. What are identifiers

* Identifiers are special symbols and names that are customized in the program. To differentiate from keywords: the keyword is the symbol that is provided by the C language by default, and the identifier is customized by the programmer.

2, the role of identifiers

* Identifiers, literally understood, are symbols used to identify something, and the purpose of the identifier is to distinguish it.

* In fact, the function of the identifier is similar to the name of the human, in order to distinguish each person, in the birth of each person has a name.

* C language is composed of functions, a C language program may have a number of functions, in order to distinguish these functions, each function is given a name. The name of the function is one of the identifiers, except for the function, the concept of "variable" will be learned later, the name of the variable is also an identifier.

3. Naming

* Naming rules (be sure to follow)

# there can only be 26 characters in English characters, 10 Arabic numerals 0~9, and an underscore _.

# strictly case-sensitive, such as test and test are 2 different identifiers

# cannot start with a number

# You can't use keywords as identifiers

* Naming Specification (best to follow)

# try to make a meaningful name, such as a complete English word, someone else can see the name of the role of this identifier, if you do not understand English, you can also use pinyin, try not to mess up, and so does not seem meaningful name.

Iv. notes

1. What is a comment

* Annotations are very important concepts in all computer languages, literally, annotations, meaning of interpretation.

* Comments can be used to explain what a piece of program or a line of code means, facilitating communication between programmers. If I finish writing a line of code and add the corresponding comment, then someone else will see this note and know what I'm doing with it.

* Comments can be any text, meaning it can be Chinese

* Annotations in development tools are generally green

2. Single-line Comment

* The single-line comment starts with two forward slashes, and starts with//, can only comment one line, from//start to the end of this line is the contents of the comment

* Anywhere can write comments: Outside the function, inside, after each statement

3, multi-line Comment

Multiline comments start with/* and the contents in the//end/* and/* are commented.

4, the role of annotations

* Annotated code does not participate in compilation

# comments are given to people, not to the computer, how can computers understand our Chinese, so when compiling the program, the comments are not compiled into the. O Target file

# from the size of the. o file you can see indirectly that the code spelled after the comment has not been compiled

* Check the code for errors

* Troubleshoot errors

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.