• This is the name to which I'm going to refer when I want to use this function. All right?

    这是我以后使用这个函数式,会采用的名字?

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • It turns out there's a new function strlen S-T-R-L-E-N that you probably have not used yet called strlen, S-T-R-L-E-N, programmers early on and still like to be succinct but communicates sufficiently what they mean.

    结果这里有个新的函数,你可能没有使用过,叫做,早期的和现在的程序员喜欢简洁地,但是能充分的传达他们的意思。

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

  • There's one more piece that we'd like to get out of that, and that is-- you may have been wondering, what's with the funky stuttering here of three double-quotes in a row. All right? And that is a specification.

    但是你没有屏蔽这个函数使用细节,在这里我们还想再讲一讲,那就是--你可能正在想,这里连续3个奇怪双引号,是干什么用的。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm using the fact that when you take a cosine and change the angle inside the cosine, it doesn't care. whereas, if you go to the sine and change the angle inside the sine, it becomes minus sine.

    我用了一个结论,当你使用余弦函数时,改变角度的正负,函数值不变,而对于正弦函数,改变角度的符号,则函数值也会变号

    耶鲁公开课 - 基础物理课程节选

  • And one of the ways you can make a program crash, intentionally or not, is to essentially use up too much memory or call too many functions and what happens is, bam, one hits the other and bad things happen.

    其中一个方式能使你的程序崩溃掉,有意或无意的,它本质上使用了太多的内存,或者调用了太多的函数,所发生的,崩掉,一个冲突了另一个,然后发生了坏事情。

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

  • Same way that I have multiplication or division as a primitive, functions are going to give me, or somebody else who wrote them for me as part of a library, a new primitive that I'm going to be able to use.

    我在用乘法或者除法当做原语,这些函数,或者别人写程序库中的函数,将会给我返回一个,我能使用的新原语。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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.

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

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

  • And we've only just begun using it, but it has just a bunch GetInt GetString GetDouble of very useful functions like GetInt, GetString, GetDouble, And so as those names imply, you can just cull these functions with no arguments and you'll get back that data type based on its name.

    我们刚开始使用了它,里面有很多的,有用的函数,像,所以,那些名字暗示,你可以挑选这些,没有参数的函数,然后你可以通过它的名字,获取他们的数据类型。

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

  • 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.

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

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

  • First, I'm going to do a sanity check strlen so we've used string length, strlen, before.

    首先,我先做一个检查,我们以前使用过字符串长度函数

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

  • And the good news was we didn't have to worry about how math did square root or anything like that, we just got it and we used it.

    也可能是其他数,好消息是,我们不必担心math函数是怎样开方的,我们只要使用它就好。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So, conceptually if you've ever wondered why you get access in all of your functions to global variables that's because they're not down here, they're at the very top of RAM and any function can access that RAM way up there, but for now the interesting player in the story is this thing called the heap.

    所以,如果你想知道为什么全局变量能在,所有的函数使用,那是因为它们不在这下面,而是在内存的顶端,那样任意函数都可以在内存中使用它们,现在,这里面一个有用的角色是,叫做堆的东西。

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

  • At the top, I've got some CS50 Library going on, argv standard I/O library; I don't bother mentioning argc or argv because I'm not going to use them in this program.

    在顶端,我使用了CS50函数库,标准输入输出库,我没有提到argc或者,因为我不会在这个程序中使用它们。

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

  • And just as with variables, you should use some common sense, some style here, and the function's name should X Y communicate what it does, calling it X or Y or Z is generally not all that helpful.

    就像变量,你使用一些常识,一些类型,和函数名需要,传达它所做的事情,把它叫做,或者Z通常是没有什么用处的。

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

  • There's been a lot of work done on these over the years, but in fact, it's pretty hard to invent a good hash function. So my advice to you is, if you want to use something was a hash, go to a library. Look up a good hash function.

    已经做过了很多的尝试和努力,但是事实是,很难发明出一个好的哈希函数,所以我给你们的建议是,如果你们想使用哈希功能,到函数库中查找一个好的哈希函数

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I don't know what the names of the variables are, I don't care, I can basically suppress away that detail.

    在solve函数使用了些什么值,我不知道里面的变量的名称,我可以简单的跳过这些细节。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • Now that I've written sqrt, I can just use it anywhere I want in the code. You've got to rely on the fact that I wrote it correctly, but you can basically suppress the details of how it's used.

    就是忽略细节,既然我已经编写了sqrt函数,我可以在代码的任何地方使用它,你完全可以依靠,我已经编写的这个函数

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • But long story short, if I want to use a function called sleep, -- the reason I, the programmer, knew to use that library -- -- that header at the top -- because it told me to in this little synopsis.

    但长话短说,如果我想要用一个叫做sleep的功能,我作为程序员知道使用那个函数库-,上面的标题-,因为在这个小的大纲中它告诉我。

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

  • As an aside, why are you able to use print F without writing out a prototype for it?

    此外,为什么我们不用写printf的函数原型,而可以使用它呢?

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

  • So before we use printf, a function, and we passed in one input and input henceforth we're gonna call arguments or parameters.

    我们在使用printf函数时,先放进去一个输入,之后的输入我们就要,调用参数了。

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

  • It's passing to this function called toupper, which if you've never used it it actually does what it says it makes it touppercase.

    它把这个传递给toupper函数,如果你们使用过,它表示的是把小写字母,转换为大写字母。

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

  • swap If main wants to give access to swap to x and Y, it just has to tell swap where x and y are.

    如果main函数想要对x和y使用,只要告诉swap,x和y在哪里。

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

  • I'm doing a little trick by the way, I'm using raw input in my function here as a just a way to stop the display.

    顺便说下在这儿我有个小恶作剧,在这个函数中,我使用了raw,input方法。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • 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函数中不能使用它。

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

  • So I could -- and the hint here is that looks like you probably do want to use CS50's library because I've included the so-called header file for it.

    所以我可以--这里的提示看起来好像,你可能的确想使用CS50的函数库,因为我包含了所谓的头文件。

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

  • malloc I'm going to now use this new, fancy function called malloc and I'm going to say x gets the return value of malloc of the size of an int.

    我现在使用这个新的,别致的函数,然后我指明x,=,malloc的int型数据的大小,的返回值。

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

  • Well, simply with the * notation at least on the way in when you declare the function called swap, you simply say this is not going to take an int and another int because that's useless.

    好的,简单说,当你声明一个函数调用swap函数时,使用*符号,你可以简单说,这不能使用一个int数和另外一个int数,因为那是无效的。

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

  • So down below is generally where main's memory goes.

    在底下,通常是main函数使用的内存。

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

  • I certainly don't want to assume they're always going to type a three-letter or a four-letter or a two-letter word I want some dynamism but that's fine because get string can get a string of any length, I can then use the string length function to just ask while the program is running how big is the string that I was handed?

    当然我不能假设他总是,输入3个字符或4个字符,或2个字符的单词,我想要动态地分配,因为GetString可以获得任意长度的字符串,然后我可以使用strlen函数,来得到那个我传递的字符串,有多长?

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

  • 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函数使用,或者我所实现的其它函数,因为它实际上是一个全局变量。

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

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

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

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