![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
gdou.linkk
这个作者很懒,什么都没留下…
展开
-
结构体内存对齐访问
先看一下下面这个程序,想想它的执行结果(内存是8位对齐的) #include <stdio.h> struct memory{ int a; char b; double c; }; int main(void) { struct memory memory1; printf("sizeof(struct memory) = %d\n",sizeof(memory1));...原创 2020-02-28 15:01:58 · 158 阅读 · 0 评论 -
C语言关键字const和指针的结合
我们先定义三个变量 1、const int *p1 2、int const *p2 3、int *const p3 p1、p2、p3这三个指针都是指向int类型的,那它们有什么区别呢 写个代码测试一下 编译一下 可看到第11,12,16行报错,从中可得出以下结论: const int * 与 int const *是一样的效果,指向的内存是不能改变的,即指针指向的内容是只读的,或者说是一个常量...原创 2020-02-17 21:28:40 · 1664 阅读 · 0 评论