![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
文章平均质量分 82
aisajiajiao
这个作者很懒,什么都没留下…
展开
-
Understanding and using c pointers 第二章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要第二章 C语言中的动态内存管理C99引入了可变长度数组(VLAs),数组长度在运行时决定,然而一旦创建后数组就不会再改变其长度。C语言中的动态内存管理分为如下几步:1.使用malloc函数分配内存2.使用这块内存来做点事情3.完后使用free函数回收分配的内存如下:int *pi = (int*) malloc(sizeof原创 2013-08-31 21:09:36 · 709 阅读 · 0 评论 -
Understanding and using c pointers 第三章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要栈帧的组成返回值程序中的函数执行完毕后返回的地址本地变量存储区为局部变量分配的内存函数参数的存储区为函数参数所分配的内存栈和基指针(Stack and base pointers)运行时为管理栈所使用的指针传递与返回指针原文:If the data needs to be modified in原创 2013-09-09 09:42:51 · 997 阅读 · 0 评论 -
Understanding and using c pointers 第四章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要An array name is not a pointer. Although an array name can be treated as a pointer attimes, and array notation can be used with pointers, they are distinct and cannot alwa原创 2013-09-16 16:41:57 · 1264 阅读 · 0 评论 -
Understanding and using c pointers 第六章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要结构声明的两种方式1.使用struct关键字struct _person{ char* firstName; char* lastName; char* title; unsigned int age;};2.使用类型定义(type definition)typedef struct _per原创 2013-09-18 16:30:54 · 946 阅读 · 0 评论 -
Understanding and using c pointers 第七章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要安全问题与指针的不恰当使用本章从三个方面来讨论安全问题1.指针声明与初始化2.指针的不当使用3.内存回收问题(deallocation problems)第一部分:指针的声明与初始化指针声明不当。如:int* ptr1,ptr2;作者本意是声明两个int指针,但是实际结果是只有ptr1被声明为指针原创 2013-09-23 22:14:29 · 1192 阅读 · 0 评论 -
Understanding and using c pointers 第八章读书笔记
tonybai在他的网站上写了一个本书的知识点纲要本章主要涉及以下几方面1.指针强转(Casting pointers)2.访问硬件设备(Accessing hardware devices)3.别名与严格别名(Aliasing and strict aliasing)4.使用restrict关键字(Use of the restrict keyword)5.线程(Thre原创 2013-10-24 09:41:56 · 1123 阅读 · 0 评论 -
Understanding and using c pointers 第一章读书笔记
指针和内存当C程序被编译后,它与三种内存打交道1.Static/Global静态变量以及全局变量被分配到该部分内存,他们在程序开始运行时被创建直到程序运行结束后才回收生存期贯穿整个程序执行过程2.Automatic(自动变量)在函数中声明的变量在函数运行时创建,其范围仅限于函数内部,其生存期也仅限于函数执行时3.Dynamic(动态内存分配)内存从堆中分配并在必要时可以原创 2013-10-25 14:16:13 · 1956 阅读 · 0 评论 -
C谜题解释
看到了这个网址http://www.gowrikumar.com/c/,作者收集了一系列网上和自己所遇到的C语言有趣的东西,我感觉挺像的风格,我下面就尝试解决一下作者提出的问题.第一题The expected output of the following C program is to print the elements in the array. But when actually原创 2013-12-02 23:13:20 · 2016 阅读 · 0 评论 -
C语言中函数原型的重要性
原文地址在此函数原型告诉编译器函数的参数个数,参数类型以及函数的返回类型.通过使用这些信息,编译器反复校对(cross check)函数定义与函数调用的参数及其数据类型.如果我们忽略了函数原型,程序可能会带着警告编译通过,且可能会正常工作.但有些时候,它会产生一些奇怪的输出而且很难找到这些程序错误,我们看个例子#include #include int main(int a翻译 2013-12-17 22:34:48 · 5129 阅读 · 0 评论