




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Chapter 2: Types, Operators and Expressions Variable Names Data Types and Sizes Constants Declarations Arithmetic Operators Relational and Logical Operators Type Conversions Increment and Decrement Operators Bitwise Operators Assignment Operators and Expressions Conditional Expressions Precedence an
2、d Order of Evaluation Data Types and sizes数据类型基本类型构造类型指针类型空类型整型字符型实型(浮点型)单精度型双精度型枚举类型数组类型结构体类型共同体类型Variable NamesNames are made up of letters, digits and underscore.The first character must be a letter or underscore.Upper case and lower case letters are distinct.The number limit of characters is not
3、 consist, depend on system. (always 8 characters)Keywords like if, else, int, etc., cant be used.Its a good habit to choose the name related to the purpose of variable.Sum, day, M.D.richie, $45, int X,x,Y,y;student_name, student_number,k1,k2,k3 = m_eng, m_math,m_elecType ConversionsRule1: “narrow” t
4、o “wide”.For example:float f;char c;f+c;/* value is double type*/Type ConversionsExplicit type conversions can be forced(coerced) in any expression (type-name) expressionExample:char c;d=(double)c;Rule1: (type-name) expression (int)(x+y) ; (int)x+y;2.12 Precedence and order of evaluationOperatorsAss
5、ociability( ) - .Left to right! + - * &Right Associability* / %Left to right+ -Left to right Left to right =Left to right= = != =Left to right&Left to rightLeft to right|Left to right2.12 Precedence and order of evaluationOperatorsAssociativity&Left to right|Left to right? :Right to left= += -+ *= /
6、= %= &= = |= =Right to leftChapter 3: Control Flow Statements and Blocks If-Else Else-If Switch Loops - While and For Loops - Do-While Break and Continue Goto and labels Chapter 4: Functions and Program Structure Basics of Functions Functions Returning Non-integers External Variables Scope Rules Hea
7、der Files Static Variables Register Variables Block Structure Initialization Recursion The C Preprocessor File Inclusion Macro Substitution return_type function_name (argument declaration)declarations and statementsfor example:int max( int x,int y)int z;z=xy?x:y;return(z); The definition of function
8、 说明:实参必须有确定的值形参必须指定类型形参与实参类型一致,个数相同若形参与实参类型不一致,自动按形参类型转换 函数调用转换参数传递方式为值传递方式:函数调用时,为形参分配单元,并将实参的值复制到形参中;调用结束,形参单元被释放,实参单元仍保留并维持原值。特点:形参与实参占用不同的内存单元;单向传递形式参数与实际参数形式参数:定义函数时函数名后面括号中的变量名实际参数:调用函数时函数名后面括号中的表达式局部变量外部变量存储类别autoregister局部static外部static外部存储方式动态静态存储区动态区寄存器静态存储区生存期函数调用开始至结束程序整个运行期间作用域定义变量的函数或复
9、合语句内本文件其它文件赋初值每次函数调用时编译时赋初值,只赋一次未赋初值不确定自动赋初值0或空字符局部变量默认为auto型局部static变量具有全局寿命和局部可见性局部static变量具有可继承性extern不是变量定义,可扩展外部变量作用域Chapter 5: Pointers and Arrays Pointers and Addresses Pointers and Function Arguments Pointers and Arrays Address Arithmetic Character Pointers and Functions Pointer ArraysMulti-dimensional Arrays Initialization of Pointer Arrays Pointers vs. Multi-dimensional Arrays Chapter 6: Structures Basics of Structures Structures and Functions Arrays of Structures Po
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 合同之二手车场地租赁合同
- 有机农产品认证咨询服务协议
- 股份制公司运营方案
- 体育健身行业私教课程运动伤害免责协议
- 劳务安全责任合同
- 高效率会议组织及策划方案
- 心理咨询师个人咨询免责协议书
- 股权出让居间协议书
- 第六单元《生日》教学设计-2024-2025学年四年级下册数学北师大版
- 第1课时 亿以内数的认识(教学设计)-2024-2025学年四年级上册数学人教版
- 2025年房屋交易代持策划协议书
- 2025年上半年赣州市于都县招聘城管协管员易考易错模拟试题(共500题)试卷后附参考答案
- 中考数学总复习第一章第3课时二次根式课件
- 天然气脱硫完整版本
- 2025年中国电子烟行业发展前景与投资战略规划分析报告
- 货物学基础 课件 项目一 任务一 货物的基本概念
- 无人机法律法规与安全飞行 第2版空域管理
- 我的小学生活
- 《商务沟通-策略、方法与案例》课件 第三章 书面沟通
- 2024具身大模型关键技术与应用报告-哈尔滨工业大学
- 提高瓦屋面太阳能板安装一次验收合格率
评论
0/150
提交评论