c语言改错题技巧

上传人:ss****gk 文档编号:231404457 上传时间:2021-12-29 格式:DOC 页数:6 大小:58KB
返回 下载 相关 举报
c语言改错题技巧_第1页
第1页 / 共6页
c语言改错题技巧_第2页
第2页 / 共6页
c语言改错题技巧_第3页
第3页 / 共6页
c语言改错题技巧_第4页
第4页 / 共6页
c语言改错题技巧_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《c语言改错题技巧》由会员分享,可在线阅读,更多相关《c语言改错题技巧(6页珍藏版)》请在金锄头文库上搜索。

1、C语言改错题技巧Computer two level C language programming, combatAccording to my many years of National Computer Rank Examination two level C language, found that many candidates on the exam in ation there is a big problem I will now experience in the teaching of two grade C language exam summary and share,

2、 hope to our exam in ati on candidates to help pass the exam! The following is on examination methods to solve the error correction problem and summarize the error correction question is mainly divided into the following categories:1, if or while statementIf the error line is a if or a while stateme

3、nt, note the following:1) first determine if the if or while keyword is correctly written;2) then see if parentheses are used to enclose the entire expression; if not, parentheses are added;3) if the conditional expression has pointer variables and no pointer operators, the pointer operator is added

4、;4) if there is only one equal to the number in the if conditional expression, that is the mathematical equal sign (=), it is rewritten as two equal numbers, that is, the logical equal sign (=);5) if the if conditional expression is the other comparison operator, it generally reverses or adds an equ

5、al number;2, for statementIf the error line is the for statement, you should pay attention to the following:1) first of all, determine whether the for is written correctly;2) and then see whether the expression in for is separated by a semicolon () ; if not, it is a semicolon.Remember, its a semicol

6、on (), not a comma!3) furthermore, analysis of for three expression, whether to do;The first expression represents the starting condition,The second expression represents the termination condition,The third expression represents the change in the cyclic variable3, return statementIf the wrong behavi

7、or return statement, you should pay attention to the following points:1) first see if you,re writing the return keyword correctly;2) then see if there is a semicolon missing, and if you add a semicoIon;3) furthermore, determine whether the variable or expression after return is correct;To analyze th

8、is problem according to the need analysis of errors, returns the variable or expression values and types.4, assignment statementIf the error line is an assignment statement, it depends on whether the assignment is correct, and then whether the assignment operator is written correct1y.5, definition s

9、tatementIf the error line is defining the statement, be careful:1) first analyze whether the variable type name is written correctly;2) and then analyze whether the initial value is correct for the variable;3) if the above are not, see if you have less defined a variable or less curly braces;6, expr

10、ession error problem:If an integer 1 in an error line is divided by an expression or variable, the integer 1 must be changed to 1: if the variable or expression is integer, only the forced type conversion is allowed7, string class problemsIf there is a string terminator in the error line, be careful

11、 to see if the terminator has been misspelled But distinguish between the characters o and numbers, O8, pointer class problemsIf there is a pointer variable in the error line and there is no pointer operator before the variable name, the pointer operator is usually added;9, function first class prob

12、lem:If the error line is the function header, be careful:1) first of all, see whether the line has a semicolon at last If there is, the semicolon is deleted; if there is a semicolon in the middle, it should be changed into a comma;2) inconsistency of parameter and argument typeIf an argument is an a

13、ddress or array name or pointer variable name, the corresponding parameter must be a pointer or an array;If the argument is a two-dimensional array name, the corresponding parameter should be an array of pointers or a two-dimensional array;If the pointer operator is used when a parameter is used lat

14、er, the parameter is better than the pointer type;If the parameter is a two-dimensional array or a pointer variable pointing to the M element, then the length of that two dimension must be the same as the length of the second dimension of the array in main.3) the type of function is inconsistentIf t

15、here are no return statements in the function, the function type is void;If there is a return statement in a function, the type of function must be the same as the variable type after rerun;Remember, the type of the calling function is consistent with the type of the function in main!10. syntax erro

16、rs:1) the statement is missing a semicolon. If the statement in the error number does not end with a semicolon, add a semicolon;2) variable name inconsistency The C language is case sensitive, and if there is any uppercase letter in the wrong line, it is usually lowercase;11. logic error problem:This topic is mainly for the expression of mistakes, and we have no more q

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号