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.
当你调用一个函数,实际上发生的是,函数得到了自己的内存块,相同的类型,是占有一样大小的内存的。
It's just a chunk of characters back to back to back so this is storing at the very first location in the string what?
它只是一串紧邻的字母串,所以它把什么存储在,字符串的第一个地址下?
Suppose I want to compute square roots a lot of places in a big chunk of code.
假设我想在一大段代码中,计算很多次平方根。
And these cases are so interesting I want to devote some chunk to a class in the next few weeks to discussing them.
这些研究都非常有研究价值,我会在随后几周的某节课里,花较多的时间来讲述这些研究
They all died. And it was--not everybody, but in France 1,500,000 people died, and that's a huge demographic chunk, it's like a big shark took a big bite out of your basic pyramid of your demographic tree.
都死了,的确是,倒不是所有人,但是在法国有一百五十万人阵亡,这在人口比例中占很大一部分,就好像一个大鲨鱼照着,人口树的基底咬了一大口
So the heap is a chunk of memory in a computer's RAM that's conceptually allocated to what's called dynamic memory allocation.
堆是在计算机RAM中的一块内存,它可以进行,动态内存分配。
It's just some random chunk of four bytes that happens to be available at this point in time, but I can put something there.
只是一些随机的四字节的内存块,在这里是可以使用的,但是我可以在那里放置东西。
Well, this will, in fact, be declared, but, unfortunately, you're using a different chunk of memory.
好的,这个被声明了,但是,不幸的是,你在使用一块不同的内存。
So, now I have x pointing at a chunk of memory what's in this memory though?
那么,现在x指向一块内存,内存中是什么呢?
So, certainly the CS50 Library designed to be dynamic and, in fact, any time you call get string, we are, in fact, ; allocating a chunk of RAM but it's not coming from the stack; it's actually coming from this portion of memory called the heap.
所以,Cs50库是动态设计的,实际上,每次你调用GetSting时,我们分配一块内存,但它不是来自栈;,而是来自于叫做堆的,内存的一部分。
It's reasonable because it's meant TMP for temporary purposes just to call it temp or T-M-P for short, X and I can define temp as -- why don't I set it as equal to X, initially, because now that I've stored X in a separate chunk of memory, I can now change its value and then I can say Y gets, not X, but temp, and so now I've actually swapped these values.
这是合理的,因为它是为,暂时的目的,只要叫它Temp或简称它为,我可以定义temp为--为什么我不把它设定为等于,最初的,因为现在我把X存储在一个单独的内存块中,我现在可以改变它的值,然后我说Y等于,不是X,而是temp,所以现在我交换这些值。
应用推荐