如题所示,我们主要讨论在自定义的内存分配函数中通常见到的代码如下所示: void Create(A** addr); 其中传递的参数是二级指针.为什么? 我们先看一下完整的动态内存分配函数的简单例子: struct A { int a = 0; int b = 0; int c[3]; }; void Create(A** addr) { printf("a1: %p\n", addr); *addr = new A(); printf("a2: %p\n", ad
小结: 1.栈内存 为什么快? Due to this nature, the process of storing and retrieving data from the stack is very fast as there is no lookup required, you just store and retrieve data from the topmost block on it. 堆内存 慢于栈内存 ,但存储空间动态,使用指针访问 Heap is used for dynam