Analysis and summary of computer grade level two C language on the wrong problem of examination

Source: Internet
Author: User
The following to correct the wrong way to do some summary, of course, these summaries can only be effective for most of the wrong line.

1, if the error line is the first part of the letter, can be divided into the following situations:

A, the line last if there is a semicolon is deleted, the middle if there is a semicolon is changed to a comma

B, the problem of inconsistent formal parameter types, in particular, the pointer type, if the following use of a parameter with a pointer operation then the parameter must be a pointer type; If the formal parameter is a two-dimensional array or a pointer variable that points to M elements, the length of the second dimension must be the same as the second dimensional length of the corresponding array in main.

C, the function type is inconsistent, if the function has no return statement then the function type is void, if there is a return statement, the function type must be the same type as the return variable.

2. If the error line is an if or a while statement, first see if you enclose the entire expression with parentheses, and if not, add parentheses.

3. If there is an if, while, for the error line, pay special attention to the error of the condition expression:

A, the application of pointer variables, if there are pointer variables in the expression and there is no pointer operator, then add the pointer operator

B, if there is only one equal number in the conditional expression, then change to two equals number, if the other comparison operators are generally reversed or add an equal number

C, for to separate expressions with semicolons, instead of commas

4. Grammatical errors

A, the statement is missing a semicolon, if there is a statement in the error line does not end with a semicolon, then add a semicolon.

B, the case is incorrect, if there are uppercase letters in the error line are generally converted to lowercase letters.

5, the use of pointer variables, if the error line has a pointer variable, and the variable name before the pointer operator is generally a pointer operator

6, if the error behavior return statement, the first to see if the semicolon is missing if the semicolon can be, otherwise is the return of the variable or expression errors (at this time, by looking at the query, to analyze the returned variable or expression)

7, if the error line to see the integral Type 1 divided by an expression, all changed to 1.0. But if an integer variable or an expression can only be cast

8, the compound operator write wrong

9, the end of the string error, if there is a string terminator to pay special attention to whether there are errors, but the 11th exception, because the problem is to convert the number of characters to the corresponding number.

10, if the error line is the definition of statements, first look at whether the type is consistent, and then see whether the assigned initial value is correct, if none of the above, see whether the definition of a variable or less curly braces.

11, the expression error (the most amount of weight, and there is no uniform change, we can only through the problem requirements to analyze and modify)

12. If there is a horizontal line in the error row, you must delete the horizontal lines and then fill in the blanks. This is also true in the fill in the blanks.

Related Article

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: 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.