• Expect the address of an int but here in the context of the function itself inside the curly braces, it means go to that address.

    一个整型数的地址,但是在函数,大括号中的环境中,意思是定位到那个地址。

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

  • Well, if intuitively the problem is the result of dividing an int by an int, surely a solution is: "Don't do that," right?

    好的,直观地看,如果那个问题的原因是因为整型数除以整型数的话,无疑有个解决方案是:“不要那样做“,是吗?

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

  • Well, you can implement this in a few different ways but here's one approach that uses some int counter=0 of the syntax we just looked at, int counter equals 0.

    当然,你可以有好几种方法来实现这一目标,但是其中一种方法,只需要用到我们刚刚看到的那种语法。

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

  • Now you have a set of parentheses as we'll see int i=0 in actual code and then I have int I equal 0.

    你将会在实际的代码中看到一对圆括号,比如,我们让。

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

  • Now get int *y so now I'll use the board for things I can't really draw very well with the keyboard so what does the memory of my program look like at the moment?

    现在,=,int,*y,现在我使用黑板,我用键盘画的不是很好,那么此刻,我程序中的内存看起来像什么?

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

  • So input is an int called F, print out to the screen or your piece of paper the value of C. Odds are you only need two, maybe three lines of code for this, but the goal ultimately will be try it on your own.

    所以输入是一个int类型的F,在你的屏幕上,或你们的纸上打印出C的数值,可能你们需要两行或者三行的代码,但是最终的目标需要你自己独自尝试。

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

  • So this declares an integer, a variable of type int called I, 0 and initializes it to zero.

    所以这里声明了一个整型数,一个叫做I的整型变量,把它初始化为。

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

  • So this line here declares a variable, just storage space called "x" and it's of type "int," which means an integer has to go in it.

    这里的这条线声明了一个变量,一个叫做“x“的存储空间,它的类型是“int“,意思是里面存储的是整数型的数据。

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

  • So unlike an int, this is the type of number that can have numbers after a decimal place.

    所以,不同于int,这个类型的数字,可以有小数位。

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

  • A few of you were probably wondering, "Well, how do I actually get the int from the user?"

    有的同学可能想知道:,“我们怎么通过用户获得那个int数值“

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

  • 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型数据的大小,的返回值。

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

  • So what data type can we use to actually get more bits of precision than an int?

    所以我们能用什么数据类型来表示,比int类型更多位数的数呢?

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

  • So there's no mention of int, and yet we've been saying for the past couple of lectures, that anytime you declare a variable, you absolutely have to specify its type.

    这里没有提及int,我们在前几个演讲中,一直讨论的东西,任何时候你声明一个变量,你必须指定它的类型。

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

  • i So I have up here at the top of my program a variable called i 0 of type int, and I have to initialize it up here to zero.

    所以在程序的顶端我有一个int类型的变量,我需要把它初始化为。

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

  • So Jordan, playing the role of human is going to type or write something down on this piece of paper, GetInt hand it back to, get int.

    所以Jordan,担任人类的角色,键入,或者在这张纸上写下点东西,把它传给。

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

  • malloc sizeof So, when I call malloc size of int and int on this system is probably 4 bytes or 32 bits so what am I getting back?

    所以,当我调用,在这个系统中int可能是4个字节,或者说32位,那么返回的是什么呢?

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

  • I have to change the prototype of this function to say that swap no longer takes an int per se or another int per se, but rather it takes two pointers, two ints, and in fact, it's on the very last page if you're still flipping.

    我改变了这个函数的原型,来说明swap不再携带那两个int数本身,而是携带两个指针,两个整型数指针,实际上,它是在最后那页上。

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

  • > Yes. You don't actually store the return value of, get int.

    >,是的,你实际上没有存储GetInt的返回值。

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

  • Then I'm declaring a variable called n, it's of type int.

    然后我声明了一个变量n,它是int型的。

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

  • So we'll talk a bit more about this idea of functions today, but, get int, again, can think of it as a black box, whose purpose in life is to prompt the human for input and pester the human if he or she doesn't actually give it int, but then once it has that, has entered it from the user, it's quote unquote, returns it to you.

    所以我们进今天将多讨论点这个函数的概念,但是,GetInt,我们可以把它当做一个黑盒子,它的唯一目的是提示人们来输入,并且如果他或她没有,给它int数,则会纠缠用户,但是一旦它得到了,用户输入的int数,对输入进行引用,返回给你。

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

  • Instead I'm going to be expecting the address of some int and the address of another int and thanks to this address I can literally find this address in RAM, do anything I want there, -- return and what I've just done is actually changed or mutate the values of those original variables.

    我们所期望的是int型地址,和另外一个int型地址,幸亏这个地址,我可以找在RAM中找到它的地址,然后做我想做的事情,返回我处理后的东西,我可能改变了这些源变量。

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

  • - So now if Christiana doesn't actually -- if either programmer or who's programming these little puzzle pieces, don't actually do anything with this return value, and I call, get int, she wants to hand this piece of paper -- to me, but if I don't actually assign -- no, no, I just messed up the demo.

    现在如果Christiana没有-,如果程序员或谁在编写这段代码,不要对这个返回值做任何事情,我调用GetInt,她把这张纸给我,但是如果我没有赋值-,不,不,我刚才把这个演示搞乱了。

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

  • Because even though it's a little confusing or a little sort of contradictory, the argument count includes the name of the program itself, -- which can actually be int useful because if someone -- if a producer changes the name of a program by renaming a file, you, the program still have access to your own name by this mechanism.

    因为即使它有点迷惑的,或有点冲突的,参数计数包括程序的名字,那个可以是int型的,因为如果有谁-,如果程序员通过重命名改变了一个程序的名字,你仍然可以用这个机制,使用你自己的名字。

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

  • It may mean something different and this is sort of just stupid re-use of syntax although frankly it wouldn't really be much fun to have yet a symbol so they went with the same symbol which is pretty reasonable in the context *a of a function prototype this just means *a expect A to be the address of an int and expect B to be the address of an int.

    这里的意思有点不同,这是为了重使用的目的,虽然这个符号没有什么意义,所以在函数原型中,他们就使用了相同的符号,这只是表示,期望,是一个int型的地址,期望b是一个int型的地址。

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

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

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

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