The basic course of C language (VI) Turbo C programming Preliminary (10)

Source: Internet
Author: User

Common errors when connecting
1. The Turbo C library function name is incorrectly written. In this case, the function is considered to be a user-defined function when connected. At this point the screen displays:
Undefined symbol ' < function name > ' in < program name >
2. When multiple file connections are not specified in "Project/project name", the project file (. PRJ file), a function error cannot be found at this time.

3. The type of the child function is inconsistent when it is described and defined.
4. The child functions called by the program are not defined.
Iii. common errors at run time
1. Path name error. In MS-DOS, a slash (\) represents a directory name, while in Turbo C the slash is an escape character of a string, so that the escape of "\" should be considered when giving a path name with the Turbo C string. For example, there is a statement:
File=fopen ("C:\new\tbc.dat", "RB");
The purpose is to open the TBC.DAT file in the new directory in C disk, but not. Here "\" immediately followed by "n" and "T", "\ n" and "\ T" will be compiled separately for line and tab characters, DOS will think it is incorrect file name and refused to accept, because the file name can not and newline or tab characters. The correct wording should be:
File=fopen ("C:\\new\\tbc.dat", "RB");
2. When formatting input and output, the specified type is inconsistent with the type of the variable itself. For example:
float L;
printf ("%c", L);
The variable address is written as a variable in the 3.SCANF () function. For example:
int l;
scanf ("%d", l);
4. In the circular statement, the loop control variable is not modified in each loop, so that the loop becomes an infinite loop.
The break statement is not used in the 5.switch statement.
6. The assignment number "=" is mistakenly used as the relation character "=".
7. If and else are not paired in a multilayered conditional statement.
8. When the memory area allocated by the dynamic memory allocation function malloc () or calloc () is used, the free () function is not released, which causes the function to be invoked several times before, and a panic occurs after the call, and cannot return to the operating system. The reason for this is that space is not available for allocation, and some space in memory is occupied by the operating system.
9. The use of dynamic allocation of memory is not successful pointer, resulting in system damage.

10. When the operation of the file, not at the end of use in time to close open files.

———————————————— "The ——————————————

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.