随笔分类 - C
摘要:十六进制与内存大小对应关系 16进制数 容量 0x400 1K 0x4000 0000 1G 16进制数 代表容量 0x10 16(byte) 0x100 256 (byte) 0x1000 4K 0x10000 64K 0x100000 1M 0x1000000 16M 0x1000 0000 2
阅读全文
摘要:#include<stdio.h> #define BASE_CR(Record, TYPE, Field) ((TYPE *) ((char *) (Record) - (char *) &(((TYPE *) 0)->Field))) typedef struct _MyStruct { int
阅读全文
摘要:typedef作用域 如果放在所有函数之外,它的作用域就是从它定义开始直到文件尾; 如果放在某个函数内,定义域就是从定义开始直到该函数结尾; #define作用域 不管是在某个函数内,还是在所有函数之外,作用域都是从定义开始直到整个文件结尾 //a.c typedef …//此处开始到文件结尾 #d
阅读全文
摘要:一、(#if使用) #if(条件满足) 执行代码1 #else 执行代码2 #endif 实例 #define A 0 //把A定义为0 #if (A > 1) printf("A > 1"); //编译器没有编译该语句,该语句不生成汇编代码 #elif (A == 1) printf("A ==
阅读全文
摘要:https://blog.csdn.net/justlinux2010/article/details/11621087
阅读全文
摘要:栈的实现 实现方式可以是顺序栈。 顺序栈的内存可以是以数组的方式静态分配,也可以malooc动态分配。 同样实现方式也可以是链式栈。 队列的实现 队列的特性用链式的方式实现较为合理。 https://blog.csdn.net/qq_35924276/article/details/81384826
阅读全文
摘要:https://blog.csdn.net/qq_25352981/article/details/81007075 https://blog.csdn.net/liangbin414/article/details/88596320 https://wenku.baidu.com/view/cbf
阅读全文
摘要:https://www.cnblogs.com/secoding/p/9609354.html https://blog.csdn.net/weixin_40204595/article/details/81584679 https://blog.csdn.net/qq_39630587/artic
阅读全文
摘要:https://wenku.baidu.com/view/486647f47c1cfad6195fa794.html https://www.cnblogs.com/jacklu/p/4729638.html https://mp.weixin.qq.com/s?__biz=MzI4MDI4MDE5
阅读全文
摘要:https://blog.csdn.net/FourLeafCloverLLLS/article/details/89513701
阅读全文
摘要:关键点:const 属于修饰符 ,修饰常量,const 修饰的位置很关键。 const修饰指针和修饰变量存在差异 修饰变量 修饰指针
阅读全文
摘要:导致栈溢出的原因 1)可能是由于循环的递归引起的。(2)由于分配了过大的局部变量引起。 https://www.cnblogs.com/dwlsxj/tag/【06】栈溢出/ https://www.jianshu.com/p/7e01ee050346
阅读全文
摘要:宏定义 https://www.cnblogs.com/wzd5230/p/10959032.html https://www.cnblogs.com/xyang0917/p/4172493.html https://blog.csdn.net/wukery/article/details/5328
阅读全文
摘要:``` #include //1、定义新的类型,结构体 struct pin_desc { unsigned int pin; unsigned int key_val; }; //2、用该类型定义变量并进行初始化 struct pin_desc pins_desc[4]= { {1,0x01}, {2,0x02}, {3,0X03}, {4,0x04}, }; voi...
阅读全文
摘要:1、定义 void (*pfun)(); void (*pfun)(int) void (*pfun)(int x) 2、使用 void add(int x) { } pfun = add; pfun(x) (*pfun)(x); 3、重新定义类型 typedef void(*FunP)(int);
阅读全文
摘要:https://www.jianshu.com/p/917c0fb8778b?utm_campaign=maleskine&utm_content=note&utm_medium=reader_share&utm_source=weixin&from=timeline 有限状态机(finite st
阅读全文
摘要:https://blog.csdn.net/zhoujian0827/article/details/78354151 https://blog.csdn.net/shimadear/article/details/80291194 https://blog.csdn.net/fovwin/arti
阅读全文
摘要:C编程规范 一、命名 1、 程序文件命名:程序文件命名要求具备模块缩写,功能描述等信息。采用每个单词首字母大写方式。 2、 函数命名 3、 结构体命名 4、 联合体命名 5、 变量命名:采用第一个单词首字母小写,后续首字母大写 6、 宏命名 define PIE 3.14 //宏定义 define
阅读全文
摘要:1、问题描述: 当在某些应用场景中,我们会根据读取到的寄存器值来判断执行某一特定的函数,为了避免寄存器的值在不更新的情况下而重复执行某一特定的函数,可运行一下简单运算,可实现边沿检测触发。 Exzample: void main() { u8 RegData = 0; for(;;) { RegDa
阅读全文