Weibrecht credits his success to good coaching, and he has received a few other pointers regarding the Vancouver Games.
VOA: standard.2010.02.09
So, you know, we've got a bunch of juicy topics to dive into this week involving pointers and memory.
这周我们有很多有趣的主题,包括指针和内存。
Number three, pointer assignment, takes one pointer and changes it to point to the same pointee as another pointer so after the assignment the two pointers will point to the same pointee.
第三条,指针赋值,使一个指针,指向另外一个指针所指向的数据,赋值过后,两个指针会指向,同样的数据。
We have a pointer to the location in memory that contains the actual value, which itself might be a bunch of pointers, and we have a pointer to the actual-- sorry, a pointer the value and we have a pointer to the next element in the list. All right?
包含实际值的地址,可能实际值,也是一系列指针,这里还有指向实际,抱歉,指向下一个元素的指针,我们来整理下?
> Okay. Well, I see the two pointers, but they don't seem to be pointing to anything.
>,好的,呃,我看到那两个指针,但是他们好像,没有指向任何东西。
They can be 64 bits, but very often on systems today are pointers 32 bits.
也可能为64位,但在通常的,系统中,指针占32位。
> Well, to get started I guess we're going to need a couple of pointers.
>,呃,我想我们需要,几个指针来开始。
> Okay. This code allocates two pointers which can point to integers.
>,好的,这段代码分配两个指针,可以指向整型数。
Now, dereferencing works on y and because the pointers are sharing 13 that one pointee, they both see the 13.
现在,解引用在y上起作用了,因为指针共享,同一个指针数据,它们两个都看到了。
Initially pointers don't point to anything.
最初指针不会指向任何东西。
Learn about pointers?
学习指针?
So, for the most part any time we talk about or draw pointers an arrow suffices, which really 71 in there is a number like 71, which is the literal byte that the F is actually in in RAM, but frankly who cares?
所以,每次我们讨论,或者用箭头表示指针,在指针里面有一个数字,如,那是F在RAM中的字节,但是谁在乎它呢?
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 No. Even though the key word has changed from char to int, the * is the same and the fact that I've got a * there is saying this is a pointer to an int or a pointer to a char pointers are always the same size on a computer.
不,即使即使关键字从char变成了,指针的大小还是一样的,我用*表示这是一个int型指针,而不是char型指针,在同一台机子上,它们的大小是一样的。
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数本身,而是携带两个指针,两个整型数指针,实际上,它是在最后那页上。
应用推荐