会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
唯一诺
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
5
6
7
8
9
10
11
12
13
···
18
下一页
2020年3月27日
C经典分析题
摘要: #include <stdio.h> #include <stdlib.h> void func(int i) { if (i > 0) { func(i/2); } printf("%d\n", i); } int main() { func(10); return 0; } 输入结果: 0 1
阅读全文
posted @ 2020-03-27 16:53 唯一诺
阅读(131)
评论(0)
推荐(0)
2020年3月25日
C之#define和inline的区别
摘要: 1.define 1.定义在预编译时处理的宏,只是简单的字符串替换,没有类型检查 2.inline 1.用来定义一个内联函数,引用inline的主要原因是用它替换C语言中表示式形式的宏定义; 2.在编译阶段完成; 3.内联函数会做类型安全检查; 4.内联函数是嵌入式代码,调用内联函数时,不是跳转到内
阅读全文
posted @ 2020-03-25 18:42 唯一诺
阅读(806)
评论(0)
推荐(0)
C之bss、data存储位置区分,使用objdump -t反汇编查看变量所处存储位置
摘要: #include <stdio.h> #include <stdlib.h> int wei; //未初始化的全局变量,bss区 int you = 0; //初始化为0的全局变量,bss区 int qing = 1; //初始化非0的全局变量,data区 int main() { static i
阅读全文
posted @ 2020-03-25 18:19 唯一诺
阅读(2699)
评论(0)
推荐(0)
C语言之volatile介绍
摘要: 编译器优化介绍: 由于内存访问速度远不及CPU处理速度,为提高机器整体性能, 1)在硬件上: 引入硬件高速缓存Cache,加速对内存的访问。另外在现代CPU中指令的执行并不一定严格按照顺序执行,没有相关性的指令可以乱序执行,以充分利用CPU的指令流水线,提高执行速度。 2)软件一级的优化:一种是在编
阅读全文
posted @ 2020-03-25 14:09 唯一诺
阅读(3643)
评论(0)
推荐(0)
c语言之extern "C"
摘要: 1.被extern "C"修饰的变量和函数是按照C语言方式进行编译和链接的:这点很重要!!!! 2.extern "C"包含双重含义 1. 从字面上可以知道,首先,被它修饰的目标是"extern"的; 2. 其次,被它修饰的目标代码是"C"的。 3. 被extern "C"限定的函数或变量是exte
阅读全文
posted @ 2020-03-25 13:39 唯一诺
阅读(795)
评论(0)
推荐(0)
2020年3月24日
函数指针和指针数组
摘要: #include <iostream> #include <string.h> #include <stdio.h> #include <stdlib.h> using namespace std; int main() { int a; //定义一个整数; int *ap; //定义一个指向整数的
阅读全文
posted @ 2020-03-24 19:39 唯一诺
阅读(261)
评论(0)
推荐(0)
2020年3月23日
C/C++之键盘输入函数(scanf、gets、getchar、cin、cin.get()、cin.getline()、getline())
摘要: 1. scanf函数 scanf()可以接收多种格式的数据,遇到回车,tab,空格时,输入结束; scanf()保留回车符号,当连续两次调用scanf时,会直接读入上一次结束scanf时的回车符号“\n” (0x0a); 没有将回车键屏蔽 #include <iostream> #include <
阅读全文
posted @ 2020-03-23 20:44 唯一诺
阅读(3599)
评论(0)
推荐(2)
2020年3月21日
面试题九宫格输入法,数字和字符串转换
摘要: #include <iostream> #include "string.h" #include <map> using namespace std; class CTransfer { public: CTransfer(); ~CTransfer(); void statToTrans(cons
阅读全文
posted @ 2020-03-21 09:44 唯一诺
阅读(622)
评论(0)
推荐(0)
2020年3月19日
结构体强制字节对齐
摘要: #pragma pack(push, 1) struct test { int a; char b; }; #pragma pack(pop)
阅读全文
posted @ 2020-03-19 09:14 唯一诺
阅读(473)
评论(0)
推荐(0)
2020年3月18日
如何判断设备大小端问题
摘要: 1. 如何判断大小端设备 #include <iostream> using namespace std; typedef union utest { int a; char b; }utest; int main(int argc, char** argv) { utest ut; ut.a =
阅读全文
posted @ 2020-03-18 20:19 唯一诺
阅读(601)
评论(0)
推荐(0)
上一页
1
···
5
6
7
8
9
10
11
12
13
···
18
下一页
公告