• When you call a function, what actually happens is that function gets its own chunk of memory that's identical in size to the data type that it expects.

    当你调用一个函数,实际上发生的是,函数得到了自己的内存块,相同的类型,是占有一样大小的内存的。

    哈佛公开课 - 计算机科学课程节选

  • Well, if that function calls another function, you put another tray on, and so that new tray represents that function's chunk of memory.

    好的,如果那个函数调用另一个函数,你再放一个托盘在上面,新的托盘代表,那个函数的内存块。

    哈佛公开课 - 计算机科学课程节选

  • Well, if you want to call a function, it's like putting another tray on that stack of trays and that tray represents a chunk of memory that, that function can use.

    嗯,如果你想调用一个函数,这就像把一个托盘放到另一个托盘上,托盘代表一块,函数可以使用的内存。

    哈佛公开课 - 计算机科学课程节选

  • So, generally speaking when a function returns the memory that it used gets overwritten or disappears.

    那么,通常来说,当一个函数返回的内存,被覆盖了或者消失了。

    哈佛公开课 - 计算机科学课程节选

  • We don't have to worry about memory disappearing just because my function is done executing.

    我们不需要担心内存消失,因为我的函数已经执行了。

    哈佛公开课 - 计算机科学课程节选

  • Now if you call a function, swap like increment or cube or swap, or in this case, foo, those variables are the parameters to that function, end up getting stored next in memory.

    现在如果你调用一个函数,像increment或者cube或者,或者在这个例子里,foo,这些变量都是,函数的参数,在内存中存储。

    哈佛公开课 - 计算机科学课程节选

  • So A gets 1, B gets 2, now the swap function itself starts executing line by line; so I declare a chunk of memory called temp.

    所以A等于1,B等于2,现在swap函数自己开始,一行一行地执行,所以我声明了,叫做temp的一块内存。

    哈佛公开课 - 计算机科学课程节选

  • 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函数。

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定