随笔分类 - C/C++系列
摘要:调试打印 通过编译器命令行或者项目配置添加-DDEBUG_SENSOR=1到编译命令中来启用调试模式 #if (DEBUG_SENSOR == 1) #define x_puts puts #define x_printf printf #else #define x_puts(...) #defi
阅读全文
摘要:path=revise10 x.exe %path%\x %path%\x.bin pause
阅读全文
摘要:问题 markdown不能分页导出pdf不美观 方案 在需要分页之处插入以下html代码,在导出pdf时生效 <div STYLE="page-break-after: always;"></div>
阅读全文
摘要:Q: Tried to run compiler executable but failed! A: 下载安装MingGW64 下载地址:https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/ att
阅读全文
摘要:串口日志保留进文件中 sample: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char **argv) { static FILE *pFile = NULL; char *acBuf
阅读全文
摘要:#include <stdio.h> #include <string.h> #include <sys/time.h> #include <unistd.h> int main(int argc, char **argv) { struct timeval dwStart; struct time
阅读全文
摘要:C语言中注意点 C把char常量视为int类型,而C++将其视为char类型, char ch = 'A'; int x = 'ABCD'; /* !< 对于int是4字节的系统,该语句出现在C程序中没有问题,但是出现在C++程序中会出错*/ 在C中,常量'A' 字符编码储存为一个int类型的值,相
阅读全文
摘要:1. 函数指令代码执行时在栈空间缓存 2. 函数参数保存在栈空间 3. sprintf最后是输入null void Example(void) { char szString[10]; sprintf(szString, "I'm a str."); return; } /* 该函数越界‘sprin
阅读全文
摘要:指针函数 : 指针函数本质是一个函数,只不过返回值为某一类型的指针(地址值)。 函数返回值必须用同类型的变量来接受,也就是说,指针函数的返回值必须赋值给同类型的指针变量。 指针函数的定义格式: 类型名 \ 函数名(函数参数列表) ; 函数指针 : 函数指针本质是一个指针,只不过这个指针指向一个函数。
阅读全文
摘要:[INT_MIN, INT_MAX] int类型的有符号数的最小值, 最大值的范围[ 2^31, 2^31 1] 头文件为 limits.h C include include int main(void) { printf("INT_MIN = %d, INT_MAX = %d\n", INT_M
阅读全文
摘要:qsort bsearch include reference http://www.cplusplus.com/info/
阅读全文
摘要:N/A的含义 N/A (Not applicable) 不适用;不可用;不知道;不适用的;不限 N/A 比较多用在填写表格的时候,表示"本栏目(对我)不适用"。 在没有东西可填写,但空格也不允许此项留白的时候,可以写N/A。 在英语国家,也会用n/a或者n.a.来表达
阅读全文
摘要:```c
int a = 10; int *p = &a; void increament(int *p)
{ (*p)++;
} void swap(int *a, int *b); int main(void)
{ int a = 10; increament(&a); printf("%d\n", a);
}
``` ```c
int arr[]...
阅读全文
摘要:基本的字符串操作 (如上图) 我会将每个函数的操作实现记录在本系列中, 因为发现网上都是单一的某些实现,没有总结 慢慢更新..... /April /15th /2019
阅读全文
摘要:1. \b backspace 2. \a alert 3. \r carriage return 4. \f form feed 换页
阅读全文
摘要:eg: for(char i = 0; i < 256; ++i) printf("%d\n", i); 输出的是什么呢?为什么?怎么改呢 output: 0 ~ 127 -128 -127 ~0 无限循环下去 出现的原因就是超出了char的取值范围 改成这样是否可以 for(unsigned ch
阅读全文
摘要:基本数据类型 遵循3个规则: 1.不同的机型只是int类型在变,根据字长定 2.int至少和short一样长 3.long至少和int一样长 notes:long是long int的缩写 short 短整型 long 长整型 2的幂表 notes:这张表必须牢记可以快速估算内存大小溢出等
阅读全文