C language-keywords, identifiers (zhi), annotations

Source: Internet
Author: User

first, the key word1. keywords

Is the C language provides the special meaning of the symbol, also known as the reserved word, in the C language in a total of 32 keywords, they were given a special meaning. Such as: main, int, struct, and so on.

2. Characteristics of keywords

1> are all lowercase

2> displays special colors in the editing tool, such as highlighting in Xcode, usually purple-brown.

Second, identifiers1. Identifiers

is to customize some of the symbols and names 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

The 1> identifier is the symbol used to identify something, and the purpose is to separate it.

There may be multiple functions and variables in the 2> C language, and each function and variable will be given a different name in order to differentiate them.

3. Naming conventions and principles

1> can only be made up of 26 letters in uppercase and lowercase, 10 Arabic numerals 0~9, and an underscore _

2> Strictly case-sensitive

3> cannot start with a number

4> cannot use keywords as identifiers

5> identifiers are as meaningful as possible to facilitate reading and communication

6> If the identifier contains more than one word, use the hump to identify it (except to start the first word, the first letter of each word is capitalized): FirstName, MyCount

Third, comments1. Notes

Note In computer language has a very important role, as the name implies, is the annotation, meaning.

2. The role of annotations

1> improves code readability and facilitates communication between programmers

2> Check Code

3> Troubleshooting Errors

3. Annotation Types

1> Single-line comment://

* Single-line comment starts with two forward slash//, can only comment one line, starting at the end of the line with a slash

* Comment can be written anywhere, inside and outside of the function, behind each statement

2> Multi-line Comment:/* */

* The multiline comment starts with/* and ends with */, the contents of * * and/* are commented

4. Nested use of annotations

1> Single-line comments can nest single-line comments, multiline comments

wow haha//Oh OH

/* Do you know how to use it? */

2> Multiline comments can nest single-line comments

/*

This is a single-line comment that is nested

This is also a single-line comment that is nested

*/

3> Multiline comments cannot nest multiple lines of comments

/*

/* This nesting is wrong */

*/

C language-keywords, identifiers (zhi), annotations

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.