So it does that for us so that you can get away with just knowing the address of the first byte and it will make sure that you know when to stop by including the special value so, in fact, get the string if you type in a three-letter word, we allocate four bytes no matter what because we need an additional byte 0 for this special sentinel value back slash zero at the very end.
它为我们做了这些事情,这样我们就可以,通过第一个字节的地址,它还可以通过包含一个特殊的值,来保证在哪里停止,如果你输入了一个三个字母的单词,就可以获得那个字符串,不管怎样,我们分配四个字节,因为我们在末端需要一个额外的字节,来保存这个特殊的标志值--反斜杠。
So, after the second line for code here char * s1 gets the return value of get string this is what the state of our world looks like.
在第二行之后,这个代码char,*s1,等于GetSting的返回值,这就是它看起来的状态。
And it treats it as a string, it's simply getting me back 52*7 the value of that string, 52 times 7, rather than the value of it.
这让Python把它当做字符串来对待,他返回给我了,一个字符串的值,而不是这个数的和。
I'm doing a test there to say, x if the string x is less than the value of b, and x does not appear before b as strings, then I was going to do, oh, a couple of things, because they're at the same block level.
我正在做一个测试来看看,字符串,是不是小于b的值,而且x不在b之前作为字符串出现,如果是真的话我就要做,一系列的操作,因为他们是在同一个块等级上。
This was the special value that said to the computer string stops here and because you have that barrier given to you at the end of every string, just the most efficient way you can pass strings around is just by passing the address of their very first bytes, the location in RAM.
这是一个特殊的值,表示的是,字符串在这里结束,因为在每个字符串的末尾,都有那个关卡,这是一个最有效率的方式,你可以通过传递,字符串的第一个字节的地址来传递一个字符串,地址是在RAM中的。
Well, this question mark becomes an O, this question mark becomes an O, and then the loop terminates 0 1 2 because it's iterating from zero to N so that's zero, 1, 2 and the length of the string is 3 so the loop terminates, but I remember that I needed to have this special sentinel value so I'm just going to put it there manually.
嗯,这个问号变成了,这个问号变成了0,然后循环结束了,以为迭代从0到N,那就是,字符串的长度是3,然后循环就结束了,但是我记得我需要这个特殊的标记值,所以需要手动的加上它。
应用推荐