int So, primitive type besides those three types, we have ints which are just integers which are similarly 32 bits.
除了这三种类型外,还有一种最原始的数据类型,32比特整数。
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.
一个整型数的地址,但是在函数,大括号中的环境中,意思是定位到那个地址。
When you think about an int or a float or a dictionary or a list, you knew that there were functions that operated on them.
当你想到整型,浮点型,或者链表时,你知道可以用函数去处理他们,但是当你传递一个参数,例如链表。
Well, if intuitively the problem is the result of dividing an int by an int, surely a solution is: "Don't do that," right?
好的,直观地看,如果那个问题的原因是因为整型数除以整型数的话,无疑有个解决方案是:“不要那样做“,是吗?
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.
你将会在实际的代码中看到一对圆括号,比如,我们让。
4 So even if the correct mathematical answer is 1.4 or whatever, when you divide an int by an int, you only have room in that variable, in the response for an actual integer.
所以即使那个正确的答案是4,或别的数值,当你用一个整型数除以一个整型数,在那个变量的返回值里,只有,存储一个整型数的空间。
The result is that when you divide an int by an int, the answer no matter what is going to be an int.
当你把一个整型数除以一个整型数时,无论如何答案将会是一个整型数。
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.
当然,你可以有好几种方法来实现这一目标,但是其中一种方法,只需要用到我们刚刚看到的那种语法。
In fact, when Facebook first debuted, random aside, ID they used I believe an int to represent your profile IDs.
在Facebook创立之初,我猜他们使用int来表示配置文件。
Well, all this time int on the blackboard I always draw an int as a square.
嗯,向来,我在黑板上用一个正方形表示一个。
Then I'd be multiplying a float by 5, so that's a float times an int.
然后我们把这个浮点数乘以,那是浮点数乘以整型数。
- And then I divide by an int -- that's okay because so long as you have a float involved at some point early on, you're okay.
然后我除以一个整型数-,那是可以的因为现在为止,我们在之前已经,引入了一个浮点数,你是对的。
So for now assume it's got to be an int or a char.
所以现在假使它是一个整数或字符。
Instead divide an int by a floating point value.
我们用一个整型数除以浮点数。
I get the int and store it in n. The switch statement takes inside its parenthesis an int or a char or some primitive type.
我得到一个整数并把它存储,到n中,switch语句的圆括号里可以是一个整数,或者一个字符或其他的基本类型。
So for now, just take it on faith that you'll have main to say int before you say main.
现在,大家要记住,先写int再写。
GetInt Let's call her, get int, for today.
我们今天叫她为。
Y Why don't I say int temp gets X. Let's say Y oh, sorry, X gets Y and then Y gets temp, this 2 would fail.
为什么我不说明,int,temp,=,X,让我们说明,哦,对不起,X=Y,然后,Y=temp,这两行将失败的。
And if it sees S-W-A-P, open parentheses, close parentheses, and it hopefully sees two ints inside of it, that's all it needs to do in order to finish compiling your code.
如果它看到了SWAP,左圆括号,右圆括号,它可能载里面看到两个int数,那是它所需要做的,用来完成代码的编译。
Well basically what we're doing is we're giving ourselves the ability to create data types the same way that we have some built-ins, so we have things like int, float, string, these are built-in data types.
就是要赋值我们自己创建,和内置的数据类型,相同的数据类型的能力,我们有一些内置的数据类型,如int,float,string等,如果你考虑下这些数据类型。
They only need to have values if you care GetInt about getting something back from them, get int, swap you care about its value; but swap, I don't want to hear it again.
它们只需要拥有值,如果你关心,它们的返回值,你关心它的返回值,但是,我不想再得到它的返回。
int A >> How can I name it int A but it works for?
>,我怎么样命名它为,但是它是有什么用的呢?
So with an integer, an int data type, you can store any number between 0 and 4 billion roughly.
只要有一个整数,一个int型的数据,就能储存任意一个,位于0到40亿之间的一个数。
int *x So I have int *x.
所以我用。
It's gonna hold integers so I have to say int as we'll see 0 and set it equal to 0.
因为需要是整数,所以我们把它定义为int类型,并初始化为。
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,现在我使用黑板,我用键盘画的不是很好,那么此刻,我程序中的内存看起来像什么?
It takes an int; deal with it when you get to it and then once you look through the whole file, should you find -- ultimately find the actual code that defines or impliments this thing.
它携带一个int数,当你获得了它就处理它,然后一旦你查看整个文件,最终你将发现实际代码中,定义或执行了这个东西。
int A Well, one, function has called swap, takes one int called A, printf followed by another int called B, and as we've seen with print F, if you have multiple arguments, you separate them by commas.
好的,函数叫做swap,一个参数是,另一个参数是int,B,我们看到的,如果你有好几个参数,把它们用逗号分开。
- We know from Wednesday if -- briefly -- that there's this thing called a "char" or "char," depending on how you want to pronounce it, which is just a single character but where there's also an int.
我们知道从周三起--简单说下-,我们有个叫做“char“或“char“,看你们怎么读它了,那代表一个单一的字符,但那里会有个整型数与之对应。
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的数值,可能你们需要两行或者三行的代码,但是最终的目标需要你自己独自尝试。
应用推荐