And now that you have patterns of bits after bits after bits, and if you chunk them up into say, eight-unit quantities, now can you start storing words and sentences, and paragraphs.
你现在按照一定模式一位一位的进行排列,如果你组成块,8位一个单位,这时候我们就可以存储字和句子以及段落。
Thing I've got a little procedure that could do that, but you know the simplest thing I could do is to say well, gee, wait a minute, why don't I just check to see if these are the same thing?
这两个点是同一个点么?,我已经写了一小块代码,可以提供这个功能,但是你知道的我可以做的,最简单的事情就是说好,嗯?,等等,我为什么不直接去看看,这两个东西相等不相等呢?
I have no idea what's here at the moment so I'm just going to draw a question mark because that memory might have been used previously for some other purpose, but we know it's currently available to us so we have four bytes of memory.
我不知道在此刻这里是什么,所以我画一个问号,因为那块内存可能在之前,为其它的目的而使用过,但是我们知道它可以为我们所使用,这样我们就有4个字节的内存。
Not a tremendous amount of inherent value in this strip of land, but it is important for where you could go by traveling through it.
这小块土地本身并没有重要的价值,但重要的是通过它可以到达的目的地。
Is it all right to steal a loaf of bread to feed a starving family or to steal a drug that your child needs to survive?
为了养活快饿死的家人而偷块面包,可以吗,或是为了救你孩子的命而偷药呢,又怎样?
Well, again, just as I said verbally a moment ago, if you're going here, you're literally touching, trying to read or change memory that's beyond the boundaries of a chunk of memory that you're supposed to be touching based on its length.
嗯,再次强调,就像我刚才说的,如果你从这里出发,你将依次接触到,试着读取或者改变内存,如果超出了你可以使用的,内存块长度的界限。
You begin to realize that all of these big seemingly complicated pieces of software in websites that you use, if you just hone in on little pieces of them at a time and you realize oh I can do that and oh I can do that.
你开始意识到,你所登陆的网站上这些大而复杂的软件,如果你只对其中的一小块代码进行研究,你就会发现,哦,我也可以来做这个。
You can kind of see where the syntax is going, looks like a loop, but you can kind of put blocks inside of you, and the little arrow suggests that once you get to the bottom just like our socks example, you're gonna do the following again.
从某种程度上你可以看到它的语法构成,像个循环,你也可以把,一些程序块放到循环中,如同短袜的例子,这个小箭头暗示你一旦到达底部,你将会重复接下来的事情。
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.
只是一些随机的四字节的内存块,在这里是可以使用的,但是我可以在那里放置东西。
Again, for those-- for whom this is blocked, I'm just dividing the rectangle into smaller squares which is to say that memory is addressable.
这是一整块的,我只是把它划分成一个个小区域,每个小区域都可以设定一个地址。
Well, a few details, a few building blocks we can start using in more compelling ways.
注意一些细节,我们可以更灵活地运用之前的一些,构建程序块。
The curly braces are then the C's way of kind of making a puzzle piece that looks like this so you can put stuff inside.
花括号是C语言的一个方式,用来做一个像这样的程序块,所以你可以把代码写在里面。
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,所以现在我交换这些值。
应用推荐