摘要: 时间优先的方式实现数据的压缩、解压缩 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> // "aaaaabbbhaihualovefangfangooooooooo" 阅读全文
posted @ 2020-08-04 16:22 ant_colonies 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 硬盘检索 将硬盘中的文件逐行读入内存进行检索,速度慢 #define _CRT_SECURE_NO_WARNINGS #include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> char path[256] 阅读全文
posted @ 2020-08-02 17:40 ant_colonies 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 函数的结构 #include <stdio.h> // 函数的别称是方法,函数是完成某一特定功能的模块 void print() // 自定义函数 { printf("锄禾日当午 \n"); // printf是系统函数 /* 函数名 printf 函数的参数 "锄禾日当午 \n" () 紧挨着函数 阅读全文
posted @ 2020-07-31 12:08 ant_colonies 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 赋值号左边的叫做左值,赋值号右边的叫右值 左值都在内存中,有内存实体;右值一般在寄存器中,左值也可作为右值 void main024() { int a = 1; //&(a + 2); &取内存地址(&在CPU中完成),而a+2位于寄存器中 a = a + 3; /* a = a + 3; 的计算 阅读全文
posted @ 2020-07-29 09:09 ant_colonies 阅读(402) 评论(0) 推荐(0) 编辑
摘要: 首先说明一下32位和64位系统下的区别: void main001() { int num = 20; int *p = &num; printf("%p \n", &p); printf("%d \n", sizeof(p)); system("pause"); } /* Name Value T 阅读全文
posted @ 2020-07-29 08:04 ant_colonies 阅读(542) 评论(0) 推荐(0) 编辑
摘要: 数据结构中的栈——先进后出,先进先出 数据结构中的堆——堆的本质是一个二叉树,包括二分法查找,朗格朗日差值查找,堆排序查找极值 结构体 void main006() { struct myStruct // 结构体的意义:将多种类型的数据整合在一起 { int a[10]; int i; }; st 阅读全文
posted @ 2020-07-25 11:40 ant_colonies 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 时间种子的随机数的生成,需要#include <time.h>。 #include <time.h> time_t ts; unsigned int num = time(&ts); srand(num); // 或者 srand((unsigned int)(time(NULL))); 时间变化的 阅读全文
posted @ 2020-07-20 15:39 ant_colonies 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 0001、选择排序法 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <time.h> 4 #define N 20 5 6 7 void main() 8 { 9 time_t ts; 10 srand((unsigned int)tim 阅读全文
posted @ 2020-07-19 08:20 ant_colonies 阅读(230) 评论(0) 推荐(0) 编辑
摘要: 001、斐波那契数列 /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1;*/ #include <stdio.h> #include <stdlib.h> /* 斐波那契数列:f(n)=f(n-1)+f(n-2);其中f(1)=f(2)=1; */ int Fib 阅读全文
posted @ 2020-07-18 09:28 ant_colonies 阅读(180) 评论(0) 推荐(0) 编辑
摘要: C程序编译过程: 1) 预编译:(其本质是将引用的文件已文本文件的方式插入到文件的开始部分) 【1】预处理阶段,凡是预处理指令内容都得进行处理 【2】预处理指令: 以"#"作为开头的命令,常见预处理指令:#define #include #if #endif #progma #include <st 阅读全文
posted @ 2020-07-16 20:26 ant_colonies 阅读(518) 评论(0) 推荐(0) 编辑