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