C语言第一章概述(讲课比赛郭先春)
格式特点 习惯用小写字母,大小写敏感 不使用行号,无程序行概念 可使用空行和空格 常用锯齿形书写格式 Compound statement missing{ 分程序漏掉"{" Declaration missing ; 说明缺少";" Declaration syntax error 说明中出现语法错误 Division by zero 用零作除数 Error writing output file 写输出文件错误 Expression syntax error 表达式语法错误 Function call missing ) 函数调用缺少右括号 xxx'' is assigned a value which is never used 给xxx赋了值但未用过 No declaration for function ''xxx'' 没有函数xxx的说明 Out of memory 内存不够用 Parameter ''xxx'' is never used 参数xxx没有用到 Possible use of ''xxx'' before definition 在定义之前就使用了xxx(警告) Redeclaration of ''xxx'' 重复定义了xxx Statement missing ; 语句后缺少";" Too few parameters in call 函数调用时的实参少于函数的参数 Too many error or warning messages 错误或警告信息太多 Unable to create output file ''xxx'' 无法建立输出文件xxx Unable to open include file ''xxx'' 无法打开被包含的文件xxx * * * * * * * * 产生背景 ALGOL 60 -> CPL 63 -> BCPL 67 -> B 70 -> C 72~73 产生过程 时间:1972~1973 地点:美国贝尔实验室 目的:UNIX操作系统 设计人: Ken.Thompson和Dennis.M.Ritchie C标准 标准C: K&R合著《The C Programming Language》 ANSI C: 1983年 87 ANSI C: 1987年 1990年国际标准的ANSI C 语言程序设计 第一章C语言概述 C 1.1 C语言出现背景 语言简洁、紧凑、灵活 运算符和数据类型丰富 程序设计结构化、模块化 语法限制不严格,自由度大 可直接对硬件操作 生成目标代码质量高,执行效率高 可移植性好 < > > > > > > 1.2 C语言特点 语言程序设计 第一章C语言概述 C 32个关键字: auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef unsigned union void volatile while < 语言程序设计 第一章C语言概述 C 1.2 C语言特点 9种控制语句: if( )~else~ for( )~ while( )~ do~while( ) continue break switch goto return < 语言程序设计 第一章C语言概述 C 1.2 C语言特点 34种运算符: 算术运算符:+ - * / % ++ -- 关系运算符:< <= == > >= != 逻辑运算符:! && || 位运算符 :<< >> ~ | ^ & 条件运算符:?: 赋值运算符:= 及其扩展 逗号运算符:, 指针运算符:* & 求字节数 :sizeof 强制类型转换:(类型) 分量运算符:. -> 下标运算符:[] 其它 :( ) - < 语言程序设计 第