0 And we'll also see backslash 0 which is actually the special character that's used at the end of a string to say no more string after this point in memory.
还有0,用于存储器中字符串末尾,表示在此之后就,没有字符了。
And you might say, wait a minute, isn't that a string, and the answer's no, I didn't say it's a string by putting quotes around it And notice how the machine responds differently to it.
你会想,等等,这不是个字符串么?,答案是否定的,我没用引号包围它就意味着它不是字符串,请注意计算机对它给出了不同的反应。
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.
它为我们做了这些事情,这样我们就可以,通过第一个字节的地址,它还可以通过包含一个特殊的值,来保证在哪里停止,如果你输入了一个三个字母的单词,就可以获得那个字符串,不管怎样,我们分配四个字节,因为我们在末端需要一个额外的字节,来保存这个特殊的标志值--反斜杠。
应用推荐