Section 10 Identifiers and their naming

1. Main content
1. Identifier: the name of the variable/constant/function in the program;
2. Identifier naming:
①can only use letters, numbers, and underscores;
②the first character cannot be a number;
③the identifier cannot be combined with the key Same words
;
④Strict case-sensitive; 3.C language keywords:
32 words in C that are given specific meanings, such as int/for/if, etc., 9 new ones for C99 and 7 new ones for C11;
4. Variable naming Conventions:
①Variable names are generally lowercase and constants are uppercase;
such as: int idex, not Index, INDEX; ②Names
should be memorable and easy to understand;
such as: on_loan, salary, not n, i, s, gz;
③ contains more identifier word, each word capitalized with underscores or initials;
such as: student_loan, studentLoan rather than studentloan;
④ most important habit, named to be consistent.
the industry commonly used Hungarian notation
rule: before the variable plus a variable type letters ;For
example: iCount represents the integer variable "number"; cSex represents the character variable "gender";
2. Click self-test

Guess you like

Origin blog.csdn.net/m0_51439429/article/details/114339786