• But here, as we saw in week zero with the shoe example putting on socks, I have to increment this variable explicitly myself.

    但是这里,像我们上周看到的,鞋子穿在袜子上,我需要亲自明确地增加这个变量。

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

  • My prototype, again, so that I can use it later increment without the compiler wondering what is this increment that you're referring to because it's not otherwise been declared.

    我的函数原型,再次强调,我可以以后使用它,这样编译器就不会疑惑这个你提及的,是什么,因为是没有,被声明的。

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

  • It does, in fact, successfully increment X, because at this point in the story, X was not scoped to main.

    它实际上成功的增加了X的值,因为在这个地方,X不是main中的范围。

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

  • 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 putting back that prototype allows me to compile this, because I'm saying proactively to the compiler hey, you're going to see a function called increment.

    把那个原型放回原处使我能够编译它,因为我提前向编译器打了招呼,将看到一个叫做increment的函数。

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

  • So even though increment is obviously increment declared and defined in this function, it's later; so it's too late for me to use it in main.

    很明显,即使在这个函数中,已经声明和定义;,也太迟了,以至于,我在main函数中不能使用它。

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

  • It makes sense to me logically that I want to see it first when I open the file; so I scroll on down but only later is increment declared.

    这个逻辑上对我是有意义的,打开文件的时候,我想先看到它,所以我向下翻,之后才声明increment函数。

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

  • But notice unlike a for loop, if you want to declare a variable or increment or decrement to variable, you've got to do that yourself.

    但请注意不像for循环,如果你想声明一个变量,或者变大或变小一个变量,你需要自己完成。

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

  • So pictorially, it's as though there's now some other part of the blackboard here, maybe way up here where I can put anything I want that's accessible to main, that's accessible to swap, that's accessible to increment or any other function I might implement because it is, in fact, global.

    绘画般地,它是在这里黑板上的其他部分,可能在这里的上面,我在哪里可以放置这些东西,使它们可以被main函数使用,可以被swap函数使用,可以被increment函数使用,或者我所实现的其它函数,因为它实际上是一个全局变量。

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

  • And when you call a function, one of the things X that happens is whatever your passing in, for instance, X, ; and if this is A, this thing gets copied into A; so at that moment in time of calling increment, I actually have two copies of the same value in memory but they're referred to by different names.

    当你调用一个函数,其中发生的一件事情是,不管你输入什么,比如,或者是A,它把这个东西复制到A中;,调用increment的时候,实际上在内存中,有两个同样的值的内存块,但是它们有不同的名字。

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

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

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

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