当前位置:文档之家› C语言中常见错误解释

C语言中常见错误解释

C语言中常见错误解释
C语言中常见错误解释

C语言中常见得错误汉语解释为了方便大家学习,资源共享。

Ambiguous operators need parentheses

不明确的运算需要用括号括起

Ambiguous symbol 'xxx'

不明确的符号

Argument list syntax error

参数表语法错误

Array bounds missing

丢失数组界限符

Array size toolarge

数组尺寸太大

Bad character in paramenters

参数中有不适当的字符

Bad file name format in include directive

包含命令中文件名格式不正确

Bad ifdef directive synatax

编译预处理ifdef有语法错

Bad undef directive syntax

编译预处理undef有语法错

Bit field too large

位字段太长

Call of non-function

调用未定义的函数

Call to function with no prototype

调用函数时没有函数的说明

Cannot modify a const object

不允许修改常量对象

Case outside of switch

漏掉了case 语句

Case syntax error

Case 语法错误

Code has no effect

代码不可述不可能执行到

Compound statement missing{

分程序漏掉"{"

Conflicting type modifiers

不明确的类型说明符

Constant expression required

要求常量表达式

Constant out of range in comparison

在比较中常量超出范围

Conversion may lose significant digits 转换时会丢失意义的数字Conversion of near pointer not allowed 不允许转换近指针

Could not find file 'xxx'

找不到XXX文件

Declaration missing ;

说明缺少";"

Declaration syntax error

说明中出现语法错误

Default outside of switch

Default 出现在switch语句之外Define directive needs an identifier

定义编译预处理需要标识符Division by zero

用零作除数

Do statement must have while

Do-while语句中缺少while部分Enum syntax error

枚举类型语法错误

Enumeration constant syntax error

枚举常数语法错误

Error directive :xxx

错误的编译预处理命令

Error writing output file

写输出文件错误

Expression syntax error

表达式语法错误

Extra parameter in call

调用时出现多余错误

File name too long

文件名太长

Function call missing )

函数调用缺少右括号

Fuction definition out of place

函数定义位置错误

Fuction should return a value

函数必需返回一个值

Goto statement missing label

Goto语句没有标号

Hexadecimal or octal constant too large 16进制或8进制常数太大

Illegal character 'x'

非法字符x

Illegal initialization

非法的初始化

Illegal octal digit

非法的8进制数字

Illegal pointer subtraction

非法的指针相减

Illegal structure operation

非法的结构体操作

Illegal use of floating point

非法的浮点运算

Illegal use of pointer

指针使用非法

Improper use of a typedefsymbol

类型定义符号使用不恰当

In-line assembly not allowed

不允许使用行间汇编

Incompatible storage class

存储类别不相容

Incompatible type conversion

不相容的类型转换

Incorrect number format

错误的数据格式

Incorrect use of default

Default使用不当

Invalid indirection

无效的间接运算

Invalid pointer addition

指针相加无效

Irreducible expression tree

无法执行的表达式运算

Lvalue required

需要逻辑值0或非0值

Macro argument syntax error

宏参数语法错误

Macro expansion too long

宏的扩展以后太长

Mismatched number of parameters in definition 定义中参数个数不匹配

Misplaced break

此处不应出现break语句

Misplaced continue

此处不应出现continue语句

Misplaced decimal point

此处不应出现小数点

Misplaced elif directive

不应编译预处理elif

Misplaced else

此处不应出现else

Misplaced else directive

此处不应出现编译预处理else Misplaced endif directive

此处不应出现编译预处理endif Must be addressable

必须是可以编址的

Must take address of memory location 必须存储定位的地址

No declaration for function 'xxx'

没有函数xxx的说明

No stack

缺少堆栈

No type information

没有类型信息

Non-portable pointer assignment

不可移动的指针(地址常数)赋值Non-portable pointer comparison

不可移动的指针(地址常数)比较Non-portable pointer conversion

不可移动的指针(地址常数)转换Not a valid expression format type

不合法的表达式格式

Not an allowed type

不允许使用的类型

Numeric constant too large

数值常太大

Out of memory

内存不够用

Parameter 'xxx' is never used

能数xxx没有用到

Pointer required on left side of ->

符号->的左边必须是指针

Possible use of 'xxx' before definition 在定义之前就使用了xxx(警告)Possibly incorrect assignment

赋值可能不正确

Redeclaration of 'xxx'

重复定义了xxx

Redefinition of 'xxx' is not identical xxx的两次定义不一致

Register allocation failure

寄存器定址失败

Repeat count needs an lvalue

重复计数需要逻辑值

Size of structure or array not known

结构体或数给大小不确定Statement missing ;

语句后缺少";"

Structure or union syntax error

结构体或联合体语法错误

Structure size too large

结构体尺寸太大

Sub scripting missing ]

下标缺少右方括号

Superfluous & with function or array 函数或数组中有多余的"&" Suspicious pointer conversion

可疑的指针转换

Symbol limit exceeded

符号超限

Too few parameters in call

函数调用时的实参少于函数的参数不Too many default cases

Default太多(switch语句中一个) Too many error or warning messages 错误或警告信息太多

Too many type in declaration

说明中类型太多

Too much auto memory in function

函数用到的局部存储太多

Too much global data defined in file

文件中全局数据太多

Two consecutive dots

两个连续的句点

Type mismatch in parameter xxx

参数xxx类型不匹配

Type mismatch in redeclaration of 'xxx' xxx重定义的类型不匹配

Unable to create output file 'xxx'

无法建立输出文件xxx

Unable to open include file 'xxx'

无法打开被包含的文件xxx

Unable to open input file 'xxx'

无法打开输入文件xxx

Undefined label 'xxx'

没有定义的标号xxx

Undefined structure 'xxx'

没有定义的结构xxx

Undefined symbol 'xxx'

没有定义的符号xxx

Unexpected end of file in comment started on line xxx 从xxx行开始的注解尚未结束文件不能结束Unexpected end of file in conditional started on line xxx 从xxx 开始的条件语句尚未结束文件不能结束Unknown assemble instruction

未知的汇编结构

Unknown option

未知的操作

Unknown preprocessor directive: 'xxx'

不认识的预处理命令xxx

Unreachable code

无路可达的代码

Unterminated string or character constant

字符串缺少引号

User break

用户强行中断了程序

Void functions may not return a value

Void类型的函数不应有返回值

Wrong number of arguments

调用函数的参数数目错

'xxx' not an argument

xxx不是参数

'xxx' not part of structure

xxx不是结构体的一部分

xxx statement missing (

xxx语句缺少左括号

xxx statement missing )

xxx语句缺少右括号

xxx statement missing ;

xxx缺少分号

xxx' declared but never used

说明了xxx但没有使用

xxx' is assigned a value which is never used

给xxx赋了值但未用过

Zero length structure

结构体的长度为零

c语言编译常见错误列表

1."c" not an argument in function sum 该标识符不是函数的参数 2.array bounds missing ] in function main 缺少数组界限符"]" 3.Array size too large in function main 数组规模太大 4.bad file name format in include directive 在包含指令中的文件名格式不正确. 5.Call of non-function in function main 调用未经过定义的函数. 6.cannot modify a const object in function main 对常量不能进行修改. 7.character constant too long in function main 字符常量太大 8.constant expression required in funtion main 数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/fb14571258.html,pound statment missing } in function main 复合语句漏掉符号"{" 10.declaration syntax error in function main 宣告语法错误 11.expression syntax in function main 表达式语法错误 12. extra parameter in call to sum in function 调用函数时使用了过多的参数 13.illegal use of floating point in function main 浮点数的不合法使用 14.illegal pionter subtraction in function main 不合法的指针相减 15.invalid pointer addition in function main 无效的指针相加 16.out of memory in function main 内存不足 17.statement missing ; in function main 语句后面漏掉分号. 警告报错

C语言常见复习题(选择填空)及参考答案

C语言常见复习题及参考答案 一、选择题 1.下述标识符中,()是合法的用户标识符。 A.A#C B.getch C.void D.ab* 2.在C语言中,字符型数据在内存中是以()形式存放的。 A.原码 B.BCD码 C.反码 D.ASCII码 3.以下选项中不合法的用户标识符是()。 A.abc.c B.file C.Main D.PRONTF 4.以下选项中不合法的用户标识符是()。 A.123 B.printf C.Anbsp; D.Dim 5.可以在C语言程序中用做用户标识符的一组标识符是()。 A.void B.as-b3 C.for D.2c define -123 -abc Do WORD If cas SIG 6.在以下各组标识符中,合法的用户标识符是(1)、(2)、(3)。 (1)A.001 B.table_1 C.0_t D.k% Int t*.1 W10 point (2)A.Fast_ B.void C.pbl D. Fast+Big abs fabs beep (3)A.xy_ B.longdouble C.*p D.CHAR 变量1 signed history Float 7.()是构成C语言的基本单位。 A.函数 B.过程 C.子程序 D.子例程 8.若有说明:char s1='\067';char s2="1";char s3='1';则s1中(1),s2中(2),s3中(3)。

(1).A.包含3个字符 B.包含2个字符 C.包含1个字符 D.无定值,说明不合法 (2).A.包含1个字符 B.包含2个字符 C.包含3个字符 D.无定值,说明不合法 (3).A.包含1个字符 B.包含2个字符 C.包含3个字符 D.无定值,说明不合法 9.若x为int型变量,则执行以下语句后,x的值为 x=6; x+=x-=x*x A.36 B.-60 C.60 D.-24 10.在C语言中,char 型数据在内存中是以()形式存储的。 A.原码 B.补码 C.ASCII码 D.反码 11.以下运算符中优先级最低的算符为(),优先级最高的为()。 A.&& B.& C.|= D.|| E.?: F.!= 12.若有运算符>、*=、<<、%、sizeof,则它们按优先级(由低至高)的正确排列顺序为 A.*= << > % sizeof B.<< *= > % sizeof C.*= > << sizeof % D.*= > << % sizeof 13.若有以下类型说明语句 char w; int x; float y; double z; 则表达式w*x+z-y 的结果是()类型。 A.float B.char C.int D.double 14.若w,x,y,z 均为int 型变量,则执行下面的语句后, w=(1), x=(2), y=(3), z=(4)。 w=5; x=4; y=w++*w++*w++; z=--x*=--x*--x;

C语言中常见的错误

."c"not an argument in function sum该标识符不是函数的参数 2.array bounds missing]in function main缺少数组界限符"]" 3.Array size too large in function main数组规模太大 4.bad file name format in include directive在包含指令中的文件名格式不正确. 5.Call of non-function in function main调用未经过定义的函数. 6.cannot modify a const object in function main对常量不能进行修改. 7.character constant too long in function main字符常量太大 8.constant expression required in funtion main数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/fb14571258.html,pound statment missing}in function main复合语句漏掉符号"{" 10.declaration syntax error in function main宣告语法错误 11.expression syntax in function main表达式语法错误 12.extra parameter in call to sum in function调用函数时使用了过多的参数 13.illegal use of floating point in function main浮点数的不合法使用 14.illegal pionter subtraction in function main不合法的指针相减 15.invalid pointer addition in function main无效的指针相加 16.out of memory in function main内存不足

C语言常见错误分析汇总

C语言常见错误分析汇总 1、 在一个工程里出现两个main函数时 3.obj : error LNK2005: _main already defined in file1.obj Debug/HELLO.exe : fatal error LNK1169: one or more multiply defined symbols found 这个就是说,你的main函数重定义了。你看看是不是你的工程里面,包含了很多个有main函数的文件? 2、 fatal error C1010: unexpected end of file while looking for precompiled header directive 出现这个错误的原因是,工程类型建错了,应该选择win 32 console application 3、拼写错误 (1)#include //头文件拼写错了 void main() { printf("doeifweofupwp"); } fatal error C1083: Cannot open include file: 'stido.h': No such file or directory (2)#inculde //include拼写错了 void main() { printf("doeifweofupwp"); } fatal error C1021: invalid preprocessor command 'inculde'(无效的预编译命令inculde) (3)#include void mian() //main拼写错了 { printf("doeifweofupwp"); }

C语言调试常见错误及修改方法(附习题)

1.调试 C 程序时常见的错误类型分析 一般情况下,错误主要分为两大类:一、语法错误。对于这种错误,用编译器很容易解决。所以,改错题的第一步是先编译,解决这类语法错误。下面总结了二级C 语言上机改错题中常见的语法错误: (1) 丢失分号,或分号误写成逗号。 (2) 关键字拼写错误,如本来小写变成大写。 (3) 语句格式错误,例如for 语句中多写或者少写分号。 (4) 表达式声明错误,例如:少了() (5) 函数类型说明错误。与main ()函数中不一致。 (6) 函数形参类型声明错误。例如:少* 等。 (7) 运算符书写错误,例如:/ 写成了。二、逻辑错误,或者叫语义错误,这和实现程序功能紧密相关,一般不能用编译器发现。对于逻辑错误可以按这样的步骤进行查找。 (1) 先读试题,看清题目的功能要求。 (2) 通读程序,看懂程序中算法的实现方法。 (3) 细看程序,发现常见错误点。 2.改错题的改错方式总结,当然这些总结只能对大部分改错行有效 1、若错误行是函数首部,可分为以下几种情况: A、该行最后若有分号则删除,中间若有分号则改成逗号 B、形参类型不一致的问题,特别是指针类型,若后面用到某形参时有指针运算则该形参必为指针类型;若形参是二维数组或指向m 个元素的指针变量,则第二维的长度必须与main 中对应数组的第二维长度相同 C、函数类型不一致的问题,若函数中没有return语句则函数类型为void,若有return语句则函数的类型必须与return 后变量的类型一致。 2、若错误行是if 或while 语句,则首先看有没有用小括号将整个表达式括起,若没有则加上小括号。 3、若错误行中有if、while 、for 则要特别注意条件表达式的错误问题: A、指针变量的应用,若表达式中有指针变量且没有指针运算符,则加上指针运算符 B、若条件表达式中只有一个等于号,则改成两个等于号,若为其它比较运算符则一般是进行逆转或加一个等于号 C、f or 中要用分号分隔表达式,而不是用逗号 4、语法错误 A、语句缺少分号,若错误行中有语句没有用分号结束,则加上分号。 B、大小写不对,若错误行中有大写字母则一般都改成小写字母。 5、指针变量的运用,若错误行中有指针变量,并且该变量名前没有指针运算符则一般都是加上指针运算符 6、若错误行为return 语句,则首先看是否是缺少分号若是则加上分号即可;否则就是return 后的变量或表达式错误(此时可通过看题意,来分析该返回哪一变量或表达式)

c语言中常见的错误

."c" not an argument in function sum 该标识符不是函数的参数 2.array bounds missing ] in function main 缺少数组界限符"]" 3.Array size too large in function main 数组规模太大 4.bad file name format in include directive 在包含指令中的文件名格式不正确. 5.Call of non-function in function main 调用未经过定义的函数. 6.cannot modify a const object in function main 对常量不能进行修改. 7.character constant too long in function main 字符常量太大 8.constant expression required in funtion main 数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/fb14571258.html,pound statment missing } in function main 复合语句漏掉符号"{" 10.declaration syntax error in function main 宣告语法错误 11.expression syntax in function main 表达式语法错误 12. extra parameter in call to sum in function 调用函数时使用了过多的参数 13.illegal use of floating point in function main 浮点数的不合法使用 14.illegal pionter subtraction in function main 不合法的指针相减 15.invalid pointer addition in function main 无效的指针相加 16.out of memory in function main 内存不足 17.statement missing ; in function main 语句后面漏掉分号. 警告报错 1."k" is assigned a value which is never used 定义了一个变量,但程序从来没用过 2.possibiy incorrect assignment in function main 这样的赋值可能不正确 3. suspicious pointer conversion in function main 可疑的指针转换 4.code has no effect in funtion main 代码对程序没效果 Ambiguous operators need parentheses:不明确的运算需要用括号括起 Ambiguous symbol 'xxx' :不明确的符号 Argument list syntax error:参数表语法错误 Array bounds missing :丢失数组界限符 Array size toolarge :数组尺寸太大 Bad character in paramenters :参数中有不适当的字符 Bad file name format in include directive :包含命令中文件名格式不正确 Bad ifdef directive synatax :编译预处理ifdef有语法错 Bad undef directive syntax :编译预处理undef有语法错 Bit field too large :位字段太长 Call of non-function :调用未定义的函数 Call to function with no prototype :调用函数时没有函数的说明 Cannot modify a const object :不允许修改常量对象 Case outside of switch :漏掉了case 语句 Case syntax error :Case 语法错误 Code has no effect :代码不可述不可能执行到 Compound statement missing{ :分程序漏掉"{" Conflicting type modifiers :不明确的类型说明符 Constant expression required :要求常量表达式 Constant out of range in comparison :在比较中常量超出范围 Conversion may lose significant digits :转换时会丢失意义的数字 Conversion of near pointer not allowed :不允许转换近指针

C语言调试常见错误

C语言调试常见错误 一、第一类错误分析 1在使用变量前未定义。 例如: main() {a=1; b=2; printf(″%d\n″, a+b); } 2语句后面漏写分号或不该加分号的地方加了分号。 C语言规定,语句必须以分号结束,分号是C语句不可缺少的一部分,这也是和其它高级语言不同的一点。初学者往往容易忽略这个分号。 如: x=1 y=2; 又如在复合语句中漏写最后一个语句的分号: {t=x; x=y; y=t } 3不该有空格的地方加了空格 例如,在用/*...*/对C程序中的任何部分作注释时,/与*之间都不应当有空格。 又如,在关系运算符<=,>=,==和!=中,两个符号之间也不允许有空格。 4定义或引用数组的方式不对。 C语言规定,在对数组进行定义或对数组元素进行引用时必须要用方括号(对二维数组或多维数组的每一维数据都必须分别用方括号括起来),例如以下写法都将造成编译时出错: int a(10); int b[5,4]; printf(″%d\n″, b[1+2,2]); 5混淆字符和字符串 C语言中的字符常量是由一对单引号括起来的单个字符;而字符串常量是用一对双引号括起来的字符序列。字符常量存放在字符型变量中,而字符串常量只能存放在字符型数组中。例如, 假设已说明num是字符型变量,则以下赋值语句是非法的: num=″1″; 6在引用数组元素或指针变量之前没对其赋初值。 例如: main() main() {int a[6],b; {int *ptr, i=1; b=a[5]; *ptr=i

┇ ┇ }} 以上两个程序段在编译时均会出现警告信息。 7混淆数组名与指针变量 在C语言中,数组名代表数组的首地址,它的值是一个常量,不能被修改。例如,在以下程序段中,用a++是不合法的。 main() {int i, a[10]; for (i=0;i<10;i++) scanf(″%d″, a++); ┇ } 8混淆不同类型的指针。 若有以下语句: int *p1, a=1; float *p2; p1=&a; 则赋值语句p2=p1是非法的。 9混淆指针说明语句中的*号和执行语句中的*号。 设有以下说明语句: int *p1, i=1; 则 *p1=&i;是不合法的。 10误将函数形参和函数中的局部变量一起定义。 例如: fun(x,y) float x, y, z; {x++; y++; z=x+y; ┇ } 11所调用的函数在调用前未定义。 main() {float a=10, b=20, c; c=fun(a,b); ┇ } float fun(x, y) float x, y; {x++; y++; ┇ } 12混淆结构体类型名和结构体变量名。 若定义了以下结构体类型student:

分析C语言编程中常见错误及解决办法

龙源期刊网 https://www.doczj.com/doc/fb14571258.html, 分析C语言编程中常见错误及解决办法 作者:胡金荣 来源:《数码设计》2018年第03期 摘要:C语言是计算机基础教学中被广泛利用的一种教学语言,是目前计算机技术应用的重要内容,利用C语言程序的编写可以为办公自动化提供更为便捷的条件,因此强调其在具体实践中的利用现实意义显著。在学习应用C语言编程发现其在实践中存在着一些比较常见的错误,这些错误对办公质量和效率有重要的影响,所以要对其进行有效的解决。本文就C语言编程中常见的错误和解决方法做具体分析,旨在指导实践工作,提升编程的效率和质量。 关键词:C语言编程;常见错误;解决办法 中图分类号:TP312.1 文献标识码:A 文章编号:1672-9129(2018)03-0021-02 Analyze Common Mistakes in C Language Programming and Solutions HU Jinrong* (Xinjiang Shihezi Engineering Technology School, Xinjiang Shihezi, 832000, China) Abstract:C language is a widely used teaching language in computer basic education. It is an important content of computer technology application. The use of C language program can provide more convenient conditions for office automation. Therefore, it emphasizes its practice. The use of real significance in the. Learning to use the C language programming found that there are some common mistakes in practice, these errors have an important impact on office quality and efficiency, so we must effectively solve it. This article analyzes the common mistakes and solutions in C language programming and aims to guide practical work and improve the efficiency and quality of programming. Keywords:C programming; common mistakes; solutions 引用:胡金荣. 分析C语言编程中常见错误及解决办法[J]. 数码设计, 2018, 7(3): 21-22. Cite:HU Jinrong. Analyze Common Mistakes in C Language Programming and Solutions[J]. Peak Data Science, 2018, 7(3): 21-22. 引言 C语言是计算机基础教学中被广泛利用的一种教学语言,从具体的分析来看,C语言的显著特点是功能比较强、使用方便且灵活,而且对语法的检查不像其他的语言那样严格。这些显

常见C语言错误提示信息

Ambiguous operators need parentheses 不明确的运算需要用括号括起Ambiguous symbol ''xxx'' 不明确的符号 Argument list syntax error 参数表语法错误 Array bounds missing 丢失数组界限符 Array size toolarge 数组尺寸太大 Bad character in paramenters 参数中有不适当的字符 Bad file name format in include directive 包含命令中文件名格式不正确 Bad ifdef directive synatax 编译预处理ifdef有语法错 Bad undef directive syntax 编译预处理undef有语法错 Bit field too large 位字段太长 Call of non-function 调用未定义的函数 Call to function with no prototype 调用函数时没有函数的说明 Cannot modify a const object 不允许修改常量对象 Case outside of switch 漏掉了case 语句 Case syntax error Case 语法错误 Code has no effect 代码不可述不可能执行到Compound statement missing{ 分程序漏掉"{" Conflicting type modifiers 不明确的类型说明符 Constant expression required

要求常量表达式 Constant out of range in comparison 在比较中常量超出范围Conversion may lose significant digits 转换时会丢失意义的数字Conversion of near pointer not allowed 不允许转换近指针 Could not find file ''xxx'' 找不到XXX文件 Declaration missing ; 说明缺少";" Declaration syntax error 说明中出现语法错误 Default outside of switch Default 出现在switch语句之外Define directive needs an identifier 定义编译预处理需要标识符Division by zero 用零作除数 Do statement must have while Do-while语句中缺少while部分Enum syntax error 枚举类型语法错误 Enumeration constant syntax error 枚举常数语法错误 Error directive :xxx 错误的编译预处理命令 Error writing output file 写输出文件错误 Expression syntax error 表达式语法错误 Extra parameter in call 调用时出现多余错误 File name too long 文件名太长 Function call missing ) 函数调用缺少右括号

【超详细】解析C语言初学者常见问题与错误

为了让新人们少走弯路少碰壁,我便打算写下此文。当然,由于我自己的水平也有限,其中可能自己也不知不觉犯了错误,望高手们果断斧正。 下面的程序,基本是摘自在CSDN,BCCN,百度知道的提问帖,以及我身边的人和我自己写的程序,限于篇幅,对于问题影响不大的部分我已经删去或改写,一些与相应问题无关的错误也一并进行了修改。 对于完整的修正后的程序都在code::blocks 10.05(编译器gcc,调试器gdb,平台Windows 7旗舰版)上运行过。 1、程序画面一闪而过 #include int main(void) { int iSignal; /*定义变量表示信号灯的状态*/ printf("the Red Light is 0,the Green Light is 1\n"); /*输出提示信息*/ scanf("%d",&iSignal); /*输入iSignal变量*/ if(iSignal==1) /*使用if语句进行判断*/ { printf("the Light is green,cars can run\n"); /*判断结果为真时输出*/ } if(iSignal==0) /*使用if语句进行判断*/ { printf("the Light is red,cars can't run\n"); /*判断结果为真时输出*/ } return 0; } 解析:在XP以上的系统用win-tc,dev-cpp等IDE编译运行此程序时,无论输入什么数字,结果都是一闪而过,因为程序执行完语句后就直接退出了。 解决方案:这里有几个办法: (1):在程序开头加上#include,然后在程序末尾加上system("pause"); 此方法仅适用于MS-DOS,windows,不适用于*nix等系统 (2):在需要暂停的地方加入一个或两个getchar(); 这种方法,实质上并不是暂停程序,而是让程序等待用户输入若干个回车。但是效果和暂停是相同的。 (3):在程序开头加上#include,在需要暂停的地方加入一个getch();,原理和上一种差不多。在win-tc里用得比较多。 2、if,for,while的判断后直接跟; 例如: #include int main(void) { int a; scanf("%d",&a); if (a == 123);////错误,if(a == 123)后面不应加上;,而应该紧跟着 ////{ printf();}代码

C语言常见错误代码释义

C语言常见错误代码释义错误代码及错误信息错误释义 error 1: Out of memory 内存溢出 error 2: Identifier expected 缺标识符 error 3: Unknown identifier 未定义的标识符 error 4: Duplicate identifier 重复定义的标识符 error 5: Syntax error 语法错误 error 6: Error in real constant 实型常量错误 error 7: Error in integer constant 整型常量错误 error 8: String constant exceeds line 字符串常量超过一行error 10: Unexpected end of file 文件非正常结束 error 11: Line too long 行太长 error 12: Type identifier expected 未定义的类型标识符 error 13: Too many open files 打开文件太多 error 14: Invalid file name 无效的文件名 error 15: File not found 文件未找到 error 16: Disk full 磁盘满 error 17: Invalid compiler directive 无效的编译命令 error 18: Too many files 文件太多 error 19: Undefined type in pointer def 指针定义中未定义类型error 20: Variable identifier expected 缺变量标识符 error 21: Error in type 类型错误 error 22: Structure too large 结构类型太长

C语言常见错误

c语言的错误对照表————在遇到错误时可以对照查看 fatal error C1003: error count exceeds number; stopping compilation 中文对照:(编译错误)错误太多,停止编译 分析:修改之前的错误,再次编译 fatal error C1004: unexpected end of file found 中文对照:(编译错误)文件未结束 分析:一个函数或者一个结构定义缺少“}”、或者在一个函数调用或表达式中括号没有配对出现、或者注释符“/*…*/”不完整等 fatal error C1083: Cannot open include file: 'xxx': No such file or directory 中文对照:(编译错误)无法打开头文件xxx:没有这个文件或路径 分析:头文件不存在、或者头文件拼写错误、或者文件为只读 fatal error C1903: unable to recover from previous error(s); stopping compilation 中文对照:(编译错误)无法从之前的错误中恢复,停止编译 分析:引起错误的原因很多,建议先修改之前的错误 error C2001: newline in constant 中文对照:(编译错误)常量中创建新行 分析:字符串常量多行书写 error C2006: #include expected a filename, found 'identifier' 中文对照:(编译错误)#include命令中需要文件名 分析:一般是头文件未用一对双引号或尖括号括起来,例如“#include stdio.h” error C2007: #define syntax 中文对照:(编译错误)#define语法错误 分析:例如“#define”后缺少宏名,例如“#define” error C2008: 'xxx' : unexpected in macro definition 中文对照:(编译错误)宏定义时出现了意外的xxx 分析:宏定义时宏名与替换串之间应有空格,例如“#define TRUE"1"” error C2009: reuse of macro formal 'identifier' 中文对照:(编译错误)带参宏的形式参数重复使用 分析:宏定义如有参数不能重名,例如“#define s(a,a) (a*a)”中参数a重复 error C2010: 'character' : unexpected in macro formal parameter list 中文对照:(编译错误)带参宏的形式参数表中出现未知字符 分析:例如“#define s(r|) r*r”中参数多了一个字符‘|’

C语言常见错误

一· 不知道你用的是什么编译器,我帮你搞定了。 头文件#include "stdafx.h"必须放在第一位;清屏的函数也要头文件#include "conio.h";input 类型是int型的,main函数也要弄成int类型的。还有char No[100];你要定义成数组撒,基本上有错的地方都帮你弄完了,完全没错误,能实现你的功能了,分给我吧,呵呵。 // 3.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include "stdio.h" /*输入输出函数*/ #include "string.h" /*字符串函数*/ #include "malloc.h" /*动态内存分配*/ #include "stdlib.h" /*杂项及内存分配函数*/ #include "conio.h" typedef struct Node{ char No[40]; char Name[40]; float Math; float Chinese; float sum; struct Node *prior; struct Node *next; }Node,*Link; Link head, s1, s2; struct Node *s; int n = 0, k = 0; void shuru(); /*函数调用声明*/ void chaxun(); void paixu(); void xiugai(); void shanchu(); int main() /*主函数*/ { int input; // clrscr(); /*清屏函数*/ do{

C语言调试常见错误及修改方法(附习题)

1.调试C程序时常见的错误类型分析 一般情况下,错误主要分为两大类: 一、语法错误。对于这种错误,用编译器很容易解决。所以,改错题的第一步是先编译, 解决这类语法错误。下面总结了二级C语言上机改错题中常见的语法错误: (1)丢失分号,或分号误写成逗号。 (2)关键字拼写错误,如本来小写变成大写。 (3)语句格式错误,例如for语句中多写或者少写分号。 (4)表达式声明错误,例如:少了() (5)函数类型说明错误。与main()函数中不一致。 (6)函数形参类型声明错误。例如:少*等。 (7)运算符书写错误,例如:/写成了\。 二、逻辑错误,或者叫语义错误,这和实现程序功能紧密相关,一般不能用编译器发现。 对于逻辑错误可以按这样的步骤进行查找。 (1)先读试题,看清题目的功能要求。 (2)通读程序,看懂程序中算法的实现方法。 (3)细看程序,发现常见错误点。 2.改错题的改错方式总结,当然这些总结只能对大部分改错行有效。 1、若错误行是函数首部,可分为以下几种情况: A、该行最后若有分号则删除,中间若有分号则改成逗号 B、形参类型不一致的问题,特别是指针类型,若后面用到某形参时有指针运算则该形参必为指针类型;若形参是二维数组或指向m个元素的指针变量,则第二维的长度必须与main 中对应数组的第二维长度相同 C、函数类型不一致的问题,若函数中没有return语句则函数类型为void,若有return语句则函数的类型必须与return后变量的类型一致。 2、若错误行是if或while语句,则首先看有没有用小括号将整个表达式括起,若没有则加上小括号。 3、若错误行中有if、while、for则要特别注意条件表达式的错误问题: A、指针变量的应用,若表达式中有指针变量且没有指针运算符,则加上指针运算符 B、若条件表达式中只有一个等于号,则改成两个等于号,若为其它比较运算符则一般是进行逆转或加一个等于号 C、for中要用分号分隔表达式,而不是用逗号 4、语法错误 A、语句缺少分号,若错误行中有语句没有用分号结束,则加上分号。 B、大小写不对,若错误行中有大写字母则一般都改成小写字母。

c语言源程序常见错误分类及其改错

c语言源程序常见错误分类及其改错.txt28生活是一位睿智的长者,生活是一位博学的老师,它常常春风化雨,润物无声地为我们指点迷津,给我们人生的启迪。不要吝惜自己的爱,敞开自己的胸怀,多多给予,你会发现,你也已经沐浴在了爱河里。 C语言源程序检查源程序中三类出错信息:致命错误、一般错误和警告。 致命错误出现很少,它通常是内部编译出错。在发生致命错误时,编译立即停止,必须采取一些适当的措施并重新编译。 一般错误指程序的语法错误、磁盘或内存存取错误或命令错误等。编译程序将根据事先设定的出错个数来决定是否停止编译。编译程序在每个阶段(预处理、语法分析、优化、代码生成)尽可能多地发现源程序中的错误。 警告并不阻止编译进行。它指出一些值得怀疑的情况,而这些情况本身又有可能合理地成为源程序的一部分。如果在源文件中使用了与机器有关的结构,编译也将产生警告信息。 编译程序首先输出这三类错误信息,然后输出源文件名和发现出错的行号,最后输出信息的内容。 下面按字母顺序分别列出这三类错误信息。对每一条信息,提供可能产生的原因和修正方法。 请注意错误信息处有关行号的一个细节:编译程序只产生被检测到的信息。因为C并不限定在正文的某行放一条语句,这样,真正产生错误的行可能在编译指出的前一行或几行。在下面的信息列表中,我们指出了这种可能。 致命错误 1.Bad call of in-line function 内部函数非法调用 在使用一个宏定义的内部函数时,没有正确调用。一个内部函数以双下划线(_ _)开始和结束。 2.Irreducible expression tree 不可约表达式树 这种错误是由于源文件中的某些表达式使得代码生成程序无法为它产生代码。这种表达式必须避免使用。 3.Register allocation failure 存储器分配失效 这种错误指的是源文件行中的表达式太复杂,代码生成程序无法为它生成代码。此时应简化这种繁杂的表达式或干脆避免使用它。 一般错误 1.#operator not followed by macro argument name

C语言错误提示英语翻译

C语言错误提示英语翻译 Ambiguous operators need parentheses -----------不明确的运算需要用括号括起Ambiguous symbol ''xxx'' ----------------不明确的符号 Argument list syntax error ----------------参数表语法错误 Array bounds missing ------------------丢失数组界限符 Array size toolarge -----------------数组尺寸太大 Bad character in paramenters ------------------参数中有不适当的字符 Bad file name format in include directive --------------------包含命令中文件名格式不正确Bad ifdef directive synatax ------------------------------编译预处理ifdef有语法错 Bad undef directive syntax ---------------------------编译预处理undef有语法错 Bit field too large ----------------位字段太长 Call of non-function -----------------调用未定义的函数 Call to function with no prototype ---------------调用函数时没有函数的说明 Cannot modify a const object ---------------不允许修改常量对象 Case outside of switch ----------------漏掉了case 语句 Case syntax error ------------------ Case 语法错误 Code has no effect -----------------代码不可述不可能执行到 Compound statement missing{ --------------------分程序漏掉"{" Conflicting type modifiers ------------------不明确的类型说明符 Constant expression required ----------------要求常量表达式 Constant out of range in comparison -----------------在比较中常量超出范围Conversion may lose significant digits -----------------转换时会丢失意义的数字Conversion of near pointer not allowed -----------------不允许转换近指针 Could not find file ''xxx'' -----------------------找不到XXX文件 Declaration missing ; ----------------说明缺少";" Declaration syntax error -----------------说明中出现语法错误 Default outside of switch ------------------ Default 出现在switch语句之外 Define directive needs an identifier ------------------定义编译预处理需要标识符Division by zero ------------------用零作除数 Do statement must have while ------------------ Do-while语句中缺少while部分 Enum syntax error ---------------------枚举类型语法错误 Enumeration constant syntax error -----------------枚举常数语法错误 Error directive :xxx ------------------------错误的编译预处理命令 Error writing output file ---------------------写输出文件错误 Expression syntax error -----------------------表达式语法错误 Extra parameter in call ------------------------调用时出现多余错误 File name too long ----------------文件名太长 Function call missing -----------------函数调用缺少右括号 Fuction definition out of place ------------------函数定义位置错误 Fuction should return a value ------------------函数必需返回一个值 Goto statement missing label ------------------ Goto语句没有标号

相关主题
文本预览
相关文档 最新文档