1.union共用体占最大的数据类型的大小
共用体运行到哪就存的是哪个数据
共用体用于数据临时处理
2.枚举
enum color
{
red,blue,yellow;
};
int main()
{
printf("%d",red);
}
输出结果为0,如果给blue赋值10,blue的输出结果为10,yellow输出结果为11
3.处理方式:
队列:从前往后处理
栈:从后往前处理
4.二分法:对有序数组进行查找
通过找中间值确定区间,如果输入的数大于中间值,中间值变成新的下限,再从新的下限和上限中取中间值,直到找到概数为止,如果上限和下限相等,那么数组里不存在输入的数
输入的数小于中间数同理
5.链表
#include<stdio.h>
#include<alloc.h>
#include<stdlib.h>
struct stu
{
int m;
char a;
struct stu *next;
};
int main()
{
printf("%d",sizeof(stu));
int i;
struct stu *head;
if(head==NULL)
{
head=(struct stu*)malloc(sizeof(struct stu));
}
scanf("%d",&head->m);
struct stu * next;//定义结构体类型的指针
for(i=0;i<5;i++)
{
next=(struct stu*)malloc(sizeof(struct stu));//malloc在内存中申请一个空间,头文件为stdlib.h
scanf("%d",&next->m);
}
//free(指针);//清除一排
}