So the heap is a chunk of memory in a computer's RAM that's conceptually allocated to what's called dynamic memory allocation.
堆是在计算机RAM中的一块内存,它可以进行,动态内存分配。
The heap offers us a solution to that problem.
堆就为那个问题提供了一个解决方案。
I store in s1 the address of the first byte that the user typed in and by the way that first bite happens to live in this new place called the heap and that's the only update to the story thus far.
我在s1中存储的是用户输入的字符串的首地址,这样第一个字节存储在这块,新的堆的地方,这个是唯一的修正。
You just forget where the memory is that you asked for on the heap and it's not going to get cleaned up on the stack because malloc puts it somewhere else.
你忘了你在堆中申请的内存在哪里,它将会被栈清除,因为malloc把它放在别的地方。
应用推荐