双语C复习资料.doc

合集下载
相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

复习资料

第一章C语言基础

基本内容

1.数据类型

2.常量

3.变量

4.表达式

5.运算符

6.格式化输入与输出

7.注释及语句

1.数据类型

是根据各种数据所占存储单元大小不同而划分了不同的数据类型。C语言中的数据类型有基本类型、构造类型和指针类型。

各种类型数据由于所占单元大小不同,故其所表示的范围也不一样。

1)int, char, float, double are all basic data types in C language. (对)

2)Provided that the length of int is 16 bits, then the value scope of unsigned int is:(B)

A.0~255 B.0~65535 C.-32768~32767 D.-256~255

3)The declaration is:

int k=0,a=0,b=0;

unsigned long w=5;

double x=1.42,y=0;

then the incorrect expression is_A__

A.y=x%3 B. w+= -2 C. x=w+5 D. k*=a+b

4) In C, basic data types are int, char, float and _double_____.

5) Given declaration: char c=’\035’; the size of c is __1____bytes.

混合数据类型的运算

1)Suppose declaration: char a=’c’; then statement: printf(“%d”,a); is wrong.(错)

2)Suppose declaration:

int a;

float x,y;

then the result data type of expression:

x+a%3*(int)(x+y)%2/4 is _float_____.

3)The data type of expression: 18/4*sqrt(4.0) is float. (错)

字符的ASCII值及其合理应用

1)Suppose declaration: char a; then expression: ch=’5+9’ is correct.(错)

2) ASCII of ‘A’ is 65.then read the following programand the result of it.

Fill the blanks:

main()

{

char a;

a=’A’+__11____;

printf(“%c”,a);

}

result: L

3) To get a character with getchar(), you can input corresponding ASCII number of the desired character from keybord.(错)

表达式类型

1)Suppose declaration:

2)int a;

3)float f;

4)double i;

5)then the result data type of expression:

6)10+’a’+i*f is __double____.

2.常量

在程序运行过程中,其值不能被改变的量称为常量,常量区分为不同的类型。常量一般从其字面形式即可判别,也可以用一个标识符代表一个常量。

字符常量的定义形式:

#define PRICE 30

字符常量定义后,在程序中不能再改变其值,如PRICE++是错误的。

1)Incorrect string constant is: (A) 字符串常量

A. ‘abc’

B. “1212”

C. “0”

D. “”

2)If Rate is a symbol constant,we can use it as Rate++. (错)

3.变量

其值可以改变的量称为变量。一个变量应该有一个名字,在内存中占据一定的存储单元,在该存储单元中存放变量的值。

变量与声明:变量命名规则,大小写敏感

1) As variable name, tmpvar and TmpVar are same. (错)

2) Keywords can be used as variable names. (错)

3)The first character of variable name must be a letter or a underscore (_). (对)

4)Which of the following is error?(A)

A.Keywords can be used as variable names.

B.We tend to use short names for local variables, especially loop indices, and longer names for external variables.

C.Upper case and lower case letters in variable names are distinct.

D.The first character of variable name must be a letter or a underscore (_).

变量赋初值

1)The statement: int n1=n2=10; is correct. (错)

2)The declaration: float f=f+1.1; is correct. (错)

3)Which of the following is the illegal variable names ?(D)

A.Lad B. n_10 C. _567 D. g#k

转义字符的应用

1)Suppose declaration: char c=’\010’;then the count of character in variable c is ___1___.

当变量成为计数器和累加器的时候如何初始化

相关文档
最新文档