So what they do is, they're describing how these thermodynamic properties change, in terms of only state functions and state variables.
他们的作用是描述,随着状态函数和状态变量的变化,系统的热力性质如何变化。
For this sprite only, means local, only this function, only this script can use this variable, make this variable for all sprites, meant it was global.
对于只为一种精灵,意思是局部的,只有这个函数中,这个脚本中才可以用这个变量,这个变量为全部精灵而创建,意思是这个变量是全局的。
And this defines formal parameters of this function. Yup.
带有其它变量的括弧,这就是函数的形参。
Change the independent variable, find the change in the function, take the ratio and that's the derivative.
改变自变量,算出函数的变量,计算比值,这就是求导
G Here, A and G, we've already got as functions of these easily controlled, conveniently controlled state variables.
这里,A和,我们已经把它们写成了,容易控制的状态变量的函数。
So if, in fact, we want to describe a wave function, we know that we need to describe it in terms of all three quantum numbers, and also as a function of our three positional factors, which are r, the radius, phi plus the two angles, theta and phi.
实际上,我们想描述波函数,我们知道我们需要,用这三个量子数来描述它,同样,波函数还是,三个位置变量的函数,它们是r半径,还有两个角度theta和。
But this choice of names, both for my functions and also for my parameters or my variables is completely up to me.
但是这个名字的选择,包括我的函数名,和我的参数名,或者变量名都是我定义的。
And when you declare a variable, whether as an argument or as literally a local variable, they only live inside of that function.
当你声明一个变量,不论是一个参数,还是一个局部变量,它们只存在函数的内部。
Well, because the memory we've been using for local variables, and for functions, storage space is what computer scientists generally call the stack.
好的,因为我们看到的内存是用于局部变量的,用于函数的,存储空间就是计算机科学家,通常说的堆。
minutes with a different variation on how to use functions to think about problems.
我想在最后的十分钟里讲一讲,怎样用不同的变量让函数。
I don't know what the names of the variables are, I don't care, I can basically suppress away that detail.
在solve函数中使用了些什么值,我不知道里面的变量的名称,我可以简单的跳过这些细节。
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.
所以,如果你想知道为什么全局变量能在,所有的函数中使用,那是因为它们不在这下面,而是在内存的顶端,那样任意函数都可以在内存中使用它们,现在,这里面一个有用的角色是,叫做堆的东西。
Sometime later, I will deal with functions of more than one variable, which I will briefly introduce to you, because that may not be a prerequisite but certainly something you will learn and you may use on and off.
再过段时间,我要开始处理多变量函数,到时候我会向你们进行简单介绍,因为那不是必须的,但是你们以后会学到,有时候还能派上用场
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,这些变量都是,函数的参数,在内存中存储。
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通常是没有什么用处的。
foo Well, if main has any local variables X or Y or temp or foo or bar, or whatever the case may be, those variables come next in memory.
好的,如果main函数有本地的变量X或Y或temp或,或bar,或者诸如此类的例子,这些变量在内存中紧随其后。
And then I'll call fast max val passing at this extra argument of the memo.
然后我会调用快速maxval函数,而它是基于这个额外变量memo的。
cs50 h It's not called standard io.h, it's called cs50.h. That's where the code we wrote for you will live and then we'll see how to do this in examples today onward but we wrote for you some tools, some functions that calls GetChar for get a character.
当然不是标准输入输出库了,而是叫做,这里面有一些我们写的代码,等一下我会举几个例子,我们写了一些函数,比如GetChar,意思是得到一个变量。
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, again, the rectangle represents your computer's RAM, the bottom represents the part of RAM that we generally call the stack, main conceptually ends up on the bottom of the stack followed foo by its local variables then the function say foo that it calls and on and on and on and up, but there is, in fact, something above all of this and we've seen this picture briefly and that's this thing called the heap.
再次,矩形表示的是计算机内存,底端表示内存的一部分,通常我们把它叫做堆栈,main函数在,堆栈的底端,之后是,它的局部变量,然后是它调用的函数,等等等等,但是那里有,实际上,在这个上面,我们粗略看看这个图画,这个东西叫做堆。
应用推荐