Well, what's nice about this program is that there's just one function, main, so we don't need to draw the stack and get things all complicated.
这个程序的优点是,这里只有一个函数main,这样我们就不需要,画出堆,也不用那么复杂。
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把它放在别的地方。
But as soon as the most recently called function finishes executing, you have to take that tray off the stack in order to get at the previous function's memory, and once he's done executing, you have to take that one off and then what's left well then main.
但是,一旦新的调用函数结束了执行,你必须从堆中把托盘拿掉,用来获得先前函数的内存,一旦他完成执行,你必须把那一块拿下来,然后剩下的是main函数。
应用推荐