• Now, if I've asked the user for a string and then a moment later I ask the user for another string, well, they're going to end up in different locations in memory just by nature of get string.

    现在,如果我要用户输入一个字符串,一会儿之后我要用户输入一个字符串,他们最终是在,不同的内存地址中。

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

  • That is the address in memory in the heap of the first byte that the user typed in.

    那是用户输入字符串一个字节,内存中堆的地址。

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

  • If you give me a number and a string, I'm going to concatenate them together, it's really different operations, but nonetheless, it's what it's going to do.

    如果给的输入一个数字和一个字符串,我将会把它们连接在一起,这实在是不正确的操作,但是无论如何,它就是会去这么做。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I didn't. I gave it a string.

    我并没输入数字,我输入一个字符串

    麻省理工公开课 - 计算机科学及编程导论课程节选

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

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

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

  • Well, get string again is returning the address of the string the user typed in, D the address of the very first character like the letter D and storing that address in this variable s1.

    好的,GetString返回的是,用户输入字符串的地址,第一个字符的地址,比如字母,然后把这个地址存储在这个变量s1中。

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

  • So STR, which I just typed up there, takes in parens, some input, and it converts it into a string, so that now I can use that John where I was expecting a string. John.

    因此STR,也就是,我刚刚输入的,然后把这个输入变更为一个字符串,因此现在我就能,在需要用字符串的地方使用这个对象了。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • So when you have a function called GetString, -- that means it's going to get a string from the user -- -- prompt the user for a string -- whereas printf is literally going to print it, not to paper, but to the screen.

    所以当你有一个叫做GetSting的函数,它的意思是从用户那获得一个字符串-,提示用户输入一个字符串-,然而printf的确是用来打印的,不是在纸上,而是在屏幕上。

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

  • This is copy2.c. At the very beginning I, again, demand say something and then I declare s1 to be a string, aka char *, and I store in s1 the string the user types in.

    这是copy2。c,在开头打印一句话,然后声明s1是一个字符串,也叫做char,*,然后把用户输入字符串存储在s1中。

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

  • I store in s1 the address of the first byte that the user typed in and by the way that first bite happens to live in this new place called the heap and that's the only update to the story thus far.

    我在s1中存储的是用户输入字符串的首地址,这样第一个字节存储在这块,新的堆的地方,这个是唯一的修正。

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

  • I would like you to look at this piece of code right here called isPalindrome.

    我将会输入一个字符串,命名为s,并局部赋值。

    麻省理工公开课 - 计算机科学及编程导论课程节选

  • I'm going to use the CS50 Library instead for user input I'm saying say something then I'd get a string from the user and I call time s1 and then I say, say something, s2 and then I get another string from the user and call it s2 and apparently this program's purpose in life is to tell me yes or no the user said the same thing both times.

    然而我使用的是CS50库来获得用户输入,我说点什么,然后从用户那里获得一个字符串,并把它叫做s1,然后我说点什么,然后从用户那里获得一个字符串,并把它叫做2,这个程序的最终目的是,告诉我两次用户输入的是不是同样的东西。

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

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

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

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