1. Good Programming habits should be followed when using variables.
<1> defining meaningful variable names helps the program to be self-contained and reduce comments.
<2> used as the identifier of the variable name. The first letter must be in lowercase. The identifiers starting with uppercase letters and all uppercase letters have special meanings.
<3> variable names use multiple words to make the program more readable. In this case, the first letter of each word except the first word must be capitalized or an underscore _ must be added between each word to distinguish different words.
2. Only the built-in data type and function object type are suitable for value passing calls. For other types, we recommend that you use reference constants instead of passing values. Because constant parameters can be referenced in a more efficient way, and the "truncation problem" can be avoided"
3. defined static storage variables, whether global or local, are defined and initialized during program compilation. In practical applications, if no initial value is assigned to a static variable, Some compilers may
Error. initialization should be performed when the variable is declared for security reasons.
4. Not all recursive mathematical formulas can be converted into recursive Programs. When designing a large program with a recursive structure, the relationship between comprehensibility and efficiency needs to be considered.
5. Any recursive program can be converted into a non-recursive program through the control system stack.
6. Declare a variable as a global variable only when most functions of the program use a variable. If there are only some functions, you should pass the variable as a parameter to these functions, instead of declaring them as global variables.
7. Internal functions (staic) play an important role in some situations. For example, you can use an internal function to prevent data corruption in other file codes by calling the function by mistake.
8. You can use the getch () function when writing a logon program. The input information is not displayed when you enter the user name and password.
9. Use the putchar and putch functions to output characters. When the output exceeds the right boundary of the window, it is automatically transferred to the next line to continue the output. When the output still does not end when the content is filled in the window, the window screen will automatically move up row by row until the output
End.
10. close the file after the user finishes using the file. If the file is not closed explicitly after the program ends, data may be lost. If the file is not properly closed, the buffer content may not be written on the disk.
11. In text mode, it is best to use the fseek function less. Because there is an escape of the library function, "\ r \ n" in text mode is still treated as two characters by the fseek function.
12. C language advanced file processing can be understood by most programmers. Therefore, if you use such advanced functions as fopen () and fgetc (), it will help programmers better understand the code.
13. The file handle can be any valid identifier, consisting of uppercase/lowercase letters, numbers, and underscores. The file handle does not have a symbolic prefix, so to make the file handle different, programmers often use
All uppercase letters.
14. Pay attention to two points when using the rename () function.
<1> you must close the file before renaming it to open it.
<2> when you use the rename function to copy a file from a unprotected location to a protected location, the file still has low permissions, that is, the file is not protected.
15. Same as above, you must disable the remove () function first.