int *x So I have int *x.
所以我用。
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,这两行将失败的。
y A square it's called X, another square it's called y and now this time I'm doing pointers to int not points to char.
一个叫做x,另外一个叫做,这一次是int型指针,不是char型指针。
int X Well, if you declare int X up top, you could certainly update X to one here.
嗯,如果你在顶端声明,你可能把X更新为1了。
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“,意思是里面存储的是整数型的数据。
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型数据的大小,的返回值。
And actually, if I don't want to clobber, as we say, overwrite the value of my variable, ; I could declare another one and store the return value in Y; Y so now I have two ints in memory; X and Y, 3 one with two, one with three.
实际上,如果你不想彻底清除,像我们说的,覆盖那个变量的值,我可以申明另一个变量Y,并在Y中保存那个返回值;,现在内存中有两个int数,X和,一个的值为2,一个为。
I'm going to call it x and how do I make a pointer to an int?
我把它叫做x,我怎样声明一个int型指针?
int Y Well, I said int X and int Y; so that gave me one square here called X, one square here ; or wherever, called Y, done, one was put in here; two was put in here, and then I called this function swap.
好的,我声明了int,X,和;,然后我这里有个正方形叫做X,一个正方形,叫做Y,完成,1放在这里;,2放在这里,然后我调用这个swap函数。
应用推荐