Program ape has a stumbling block: if you write code without comments, JJ is as long as comments! In fact, good code style and programming habits, even without code comments, can make people appreciate (desire) heart (cry) happy (no) eyes (tears)!
If you want to practice this skill, you have to obey your own naming rules, whether it is C language or C + + or other programming languages, you must abide by your own naming rules, so that you can be correctly recognized and compiled by the compiler!
When defining a variable, the variable name can be a combination of letters, numbers, and underscores. However, it is not a random combination. We should pay attention to the following naming rules:
1) Variable names must begin with letters or underscores, not numbers. In practical programming, the most commonly used is to start with a letter, and the variable name starting with an underline is system specific. In programming, never use an underline as the beginning of a variable name unless it is required to do so;
Int 8A = 0; // wrong writing Int a = 0; // correct writing
2) Letters in variable names are case sensitive. For example, a and a are different variable names, and num and num are also different variable names;
//Define two variables, Num num num, and initialize them to 0 int num = 0; int Num = 0;
3) The variable name must not be a C language keyword, this must be remembered! Therefore, in order to avoid conflicts with system defined names;
Int int = 0; // wrong writing method: int is the keyword shaped by C language Int float = 0; // wrong writing method: float is the keyword of C language floating point number
4) Variable names cannot have spaces. This can be understood as follows: as we said above, the variable name is a combination of letters, numbers and underscores. There is no space item;
Int a B = 0; // wrong writing Int AB = 0; // correct writing
For detailed nomenclature, see: C / C + + variable naming – Hungarian nomenclature
Guess you like it:
1. Install visual studio 2015
2. Install visual studio plug-in visual assist
3. Set visual studio font / background / line number
4. Completely uninstall Visual Studio 2008
5. Completely uninstall visual studio 2013 / 2015
Reprint please note: ape programming ＂ C language tutorial ＂ C language variable declaration and definition
Please contact the blogger directly for technical exchange and business cooperation
Scan code or search: ape programming
Ape theory programming micro
Trust the official account, sweep the attention.