基本数据类型
数据类型 | 位数 | 字节数 | 值域 |
---|---|---|---|
signed char | 8 | 1 | -128~+127 |
usigned char | 8 | 1 | |
signed short | 16 | 2 | |
unsigned short | 16 | 2 | |
signed int | 16 | 2 | |
unsigned int | 16 | 2 | |
signed long | 32 | 4 | |
unsigned long | 32 | 4 | |
float | 32 | 4 | |
double | 64 | 8 |
运算符
略
流程控制
if - else
for 循环
while
do while
指针
- 指针的定义:
int * pl;
- 指针变量的赋值
int a;
int *pl; // *此处用作类型声明
pl = &a; // &取地址运算符
- 指针的运算
int a,b;
int *pl;// 指针类型
pl = &a;// 取地址
a = 80;
b = *pl;// 取内容
int a[5];
int * pl;
pl = &a; // pl 为 a[0]
pl = pl + 2; // pl 为 a[2]
- void指针类型 可以把任何类型的指针赋值给void
结构体
struct student
{
int a;
int b;
int c;
};
struct student
{
...
...
...
};s1
struct student* Pstudent
用Pstudent->a = 10; 来进行赋值
由于结构体指针是指结构体的一个指针,即结构体中第一个成员的首地址,因此在使用之前应该对结构体指针初始化,即分配整个结构体长度的字节空间
Pstudent = (struct student*)malloc(sizeof(struct student))
- 预处理
typedef
来源:CSDN
作者:谁的铁王座
链接:https://blog.csdn.net/jokerxsy/article/details/103941641