学习笔记-202008

多维数组

c语言中通常用多维数组来表示表。
多维数组的自增1时,是逐行递增,所以想逐行浏览就需要自增n(列数)

extern

extern用在变量前表示该变量的定义在外部;
extern用在函数前,没有实际意义,可以不写,因为默认情况下函数就是extern的。
参考链接:
https://blog.csdn.net/zengaliang/article/details/78337712?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param
https://blog.csdn.net/u012241570/article/details/80730859

https://blog.csdn.net/qq_38880380/article/details/81474580

excel分组分级显示

https://www.xuexila.com/excel/2007/3755759.html

编码规范

内部函数和变量在.c文件内声明,外部函数在.h中声明。

内存变量什么时候刷新到硬盘?

当系统发bai出保存数据命令时,就会将内存du中相应的数据写zhi到硬盘上保存啦。还有一种情况,就是电dao脑的内存容量较小,内存中数据不能满足CPU使用需求时,会将暂时用不上的数据写入硬盘上的Filepage.sys(虚拟内存)中保存,用时再读到内存中啦。
参考链接:https://zhidao.baidu.com/question/1115105697270303459.html

C语言中数字后面加个大写字母U是什么意思?

加个大写字母U意思是无符号整型。
在对应的带符号整型前面加上unsigned,也就是zhiunsigned int、unsigned short、unsigned long、unsigned long long。其中unsigned int可以直接写为daounsigned。 }无符号整型不能存储负数,但存储的最大值可以扩大一倍,例如unsigned的范围就是0~232-1。

编码思维

Input->handle->output(Interface)

map和hashmap

std::map是红黑树排序;

hashmap即std::unordered_map,是采用hash排序,hash排序查找速度快,但运行hash函数需要额外时间。

今天想查一下c++ hashmap的使用方法,搜出来的一些文章实在辣眼睛,竟然很多都混淆了c++中map和hashmap的区别。

首先,c++ 标准库的std::map内部是排序的,内部使用的是红黑树实现,不管是增加还是查找的时间复杂度 O(logN)

O(logN)。

而c++ 标准库的hashmap其实叫作std::unordered_map,其增加和查询的时间复杂度才是 O(1)

O(1)。它提供了类似map的方法。在c++11下直接使用头文件#include <unordered_map> 就可以了,如果不在c++11标准下,也可以使用#include <tr1/unordered_map> 来支持hashmap.

当然有人可能会说其实c++有个叫作hash_map的库,但那不是标准库,引用一个stackoverflow的评论来告诉你如何取舍:

@ShameelMohamed, 2017, i.e. 6 years after C++11 it should be hard to find an STL that doesn’t provide unordered_map. Thus, there is no reason to consider the non-standard hash_map. – maxschlepzig Feb 13 '17 at 10:42

参考链接:
https://blog.csdn.net/mgsweet/article/details/105649792
https://blog.csdn.net/forever__1234/article/details/89647975

编码规范

只有一条执行语句的if语句,可以使用三目运算符代替。

杂记

引用时别名,指针时地址。

define CONST(type, memclass) const type

当遇到CONST(type, memclass) 的时候,会被const type 所替代。

typedef int myint_t;

define MAXTIME 1000

posted @ 2020-08-09 19:59  多弗朗强哥  阅读(176)  评论(0编辑  收藏  举报