(一)struct结构
//1
struct Stu{
char *name;
int id;
int age;
char group;
float score;
};
//别忘了struct声明。
struct Stu stu1, stu1;
//2: 2步合1步,直接定义变量名
struct Teacher{
char *name;
int id;
int classroom;
}te1, te2;
//3: 局限这两个变量
struct{
char *name;
char position;
}school1, school2;
//4: 可以省去struct前缀
typedef struct{
GameObject data[maxsize];
int top;
}Stack;
(二)指针
一句话:指针=访问房间的门卡。
*a+5,表示对a做一次间接访问,读它的值再加5,*(a+5)的话表示a加上5个地址再间访
(三)s.top 和 s->top区别
s.top是结构访问;s->top是指针访问。
(四)data[top++]=x 和 data[++top]=x区别
data[top++]=x 相当于
1.) data[top] = x;
2.) top += 1;
data[++top]=x 相当于
1.) top += 1;
2.) data[top] = x;