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.
当你调用一个函数,实际上发生的是,函数得到了自己的内存块,相同的类型,是占有一样大小的内存的。
And the problem is, that we want to build this abstract data type, but we'd like to basically know what kind of object is it, and what functions actually belong to it, how do we use them?
然后我对它们运行了这个方法,就是这一小段代码这个方法,这有意义么?,当然没有了,对不对?,因为你知道,当你把两个极坐标,表示的点进行相加运算的时候?
- >> Is there a data type for representing 1,024 bits or -- >> David: Good question.
>,有没有能表示1024位大小的数据类型或-,>>,大卫:好问题。
You have to be ever so explicit as to what data type your actually passing in.
你必须很清楚,你们输入的参数是什么类型的。
A synonym for this is an abstract data type.
还有文献资料等等。
So with an integer, an int data type, you can store any number between 0 and 4 billion roughly.
只要有一个整数,一个int型的数据,就能储存任意一个,位于0到40亿之间的一个数。
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.
我们刚开始使用了它,里面有很多的,有用的函数,像,所以,那些名字暗示,你可以挑选这些,没有参数的函数,然后你可以通过它的名字,获取他们的数据类型。
String is actually not a data type in C. It actually is something called a char star and we'll come back to this before long.
字符串在C语言里其实不是一种数据类型,而是一种称为char,*的数据类型,这个知识点我以后会讲到。
Here I'm declaring another data type altogether.
这里我声明另一个数据类型。
Associated with every data type in Python is a type, which identifies the kind of thing it is.
在Python中每种类型都对应着一种数据类型,类型确定了对象的种类。
Did the same thing with c p 2, 2 2 0 Again, remind you, c p 2 is a different instance of this data type.
建立了一个x变量,我也把它赋值为,因此cp1内置有了x和y值,然后对cp2做同样的操作。
So what data type can we use to actually get more bits of precision than an int?
所以我们能用什么数据类型来表示,比int类型更多位数的数呢?
What we're really doing, or I shouldn't say what we're really doing, a basic piece of what we're doing, when we talk about classes or objects, is we're doing something that Professor Guttag mentioned, we're defining an abstract data type.
或者我不应该,说我们真正要做的,当我谈到类或者对象的时候,我们在做的基本的东西,如Guttag教授提到的,就是定义一个抽象数据类型,那么这到底是什么意思呢?
So might have been seen long and that might be correct on some servers, but very, very often the data type called "long" is actually 4 bytes.
你们有可能看到过long,那个在一些服务器上是正确的,但是非常,非常普遍的是,那个叫做“long“的数据类型,只占有4个字节。
We did it for silly purposes just to see how big each data type was, but on most systems the size of a char is what?
只是为了很傻的目的,来看看每个数据类型多大,但是在大多数的系统中char的大小是多少呢?
So we talked about Mr. Bool briefly last week in this idea of true or false, but in C, you don't have a Boolean data type.
我们上周简短地谈论过Bool先生的,真假的逻辑思想,但是在C语言里,没有布尔数据类型。
And I don't quite remember from reading or from class how big these things are, well, it turns out -- and this is sometimes useful, later on more likely than now -- but C has a size of operator that takes an argument in parenthesis and it will tell you how much space is used to store that particular data type.
我不太记得类中的这些类型,是多大的,嗯,结果是--这个在以后比现在,可能是更有用的--不过C语言中有个sizeof的操作符,其中括号里有一个参数,它会告诉我们,要存储一个类型的数据,需要占用多大空间。
应用推荐