• 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.

    它为我们做了这些事情,这样我们就可以,通过第一个字节的地址,它还可以通过包含一个特殊的值,来保证在哪里停止,如果你输入了一个三个字母的单词,就可以获得那个字符串,不管怎样,我们分配四个字节,因为我们在末端需要一个额外的字节,来保存这个特殊的标志值--反斜杠。

    哈佛公开课 - 计算机科学课程节选

  • I certainly don't want to assume they're always going to type a three-letter or a four-letter or a two-letter word I want some dynamism but that's fine because get string can get a string of any length, I can then use the string length function to just ask while the program is running how big is the string that I was handed?

    当然我不能假设他总是,输入3个字符或4个字符,或2个字符的单词,我想要动态地分配,因为GetString可以获得任意长度的字符串,然后我可以使用strlen函数,来得到那个我传递的字符串,有多长?

    哈佛公开课 - 计算机科学课程节选

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定