考验数据结构所需的程序语言基础:
一、(1)基本类型:
数据类型:short、int、long、float、double(用来存储各种数字如整数、小数)。考验数据结构中常用的有两种:int(存储整数)float(存储小数)字符类型:char(存储字符)用法:
1 int a;2 int b=1;3 int b,c,d =2;4 存取:a=1;d=b;5 char a;6 char b='A';7 char b,c,d='A';(2)指针型:
(3)构造类型:
结构体:不同类型变量组合在一起构成的变量。
代码:
1 typedef struct{ 2 int a; 3 float b; 4 char c; 5 }S; 6 7 S s; 8 s.a=1; 9 s.b=1.111;10 s.c='A';11 R=s.a;(4)void
二、控制语句
(1)判断语句
条件:
(2)循环语句
break和continue
三、函数
1 int add(int a, int b){ 2 return a+b; 3 } 4 调用:result = add(1,2); 5 6 void F(){ 7 ... 8 } 9 调用:F();10 11 int result = 0;12 void getResult(int &r){13 ++r; 14 }15 调用:getResult(result);16 17 int *p = NULL;18 void getResult(iny *&p){19 p=q; 20 }21 22 调用:getResult(p); View Code
四、逻辑结构
没关系 一对一一对多 多对多
五、存储结构
(1)顺序结构
(2)链式结构
转载于:https://www.cnblogs.com/SanChauncy/p/11156082.html