Dark Horse Programmer C Language: identifier concept and its naming principle

Source: Internet
Author: User

1. Identifiers

In the C language, symbolic constants, variables, arrays, functions, etc. all require a certain name, and we make this name an identifier.

2. The principle of naming identifiers
Naming rules:
1. Can only be composed of letters, numbers, underscores or dollar signs ($)
2. Cannot start with a number
3. Cannot duplicate the keyword
4. Strictly case-sensitive

Naming conventions:

1. Identifier naming specification

Naming conventions:

Make a meaningful name.
Hump naming: The first word starts with a lowercase letter, the first letter of the second word is capitalized, or the first of each word
Letters are capitalized.

2. What are the naming conventions for identifiers?

1) The name should be intuitive and can be spelt, to look at the text to understand, easy to remember and read.
2) The length of the designation should conform to the "Min-length && max-information" principle.
3) When the identifier is composed of more than one word, it is recommended to use the "Hump naming" method.
4) Try to avoid the number of numbers in the name, such as Value1,value2, unless it is logically necessary to number.
5) Add Range qualifier to global variables or functions that are used in conjunction with multiple files
6) The identifier name is divided into two parts: the canonical identifier prefix (suffix) + meaning identification.

Dark Horse Programmer C Language: identifier concept and its naming principle

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.