It converts things into a string type.
它把东西转换为字符串的格式。
There's a whole bunch of blocks that we'll look at in more fun detail on Friday but I'm going to pick the easiest one here and I'm going to type Hello CS50 in this string, "Hello CS50", zooming in say how nice the puzzle pieces are nicely interlocked?
今天我们看到的各种图块,到下周五我会仔细讲解其中的精妙之处,但今天我只想举一个最简单的例子,我要在这儿键入字符串,放大窗口,然后看看这漂亮的图形和文字,是如何美妙地连结在一起的?
Well I need to take that number and I'm going to turn it into a string. So notice what I'm going to do right here. I take that number and convert it into a string. That's an example of that type conversion we did earlier on. By doing that it makes it possible for me to treat it as an ordered sequence of characters.
我可能得把这个数字变为字符串,请注意我这里是怎么做的,我把这个数字,转化为字符串了,这是我们之前学过的,类型转换的例子,这么一来我就能把它按照有序的。
String is actually not a data type in C. It actually is something called a char star and we'll come back to this before long.
字符串在C语言里其实不是一种数据类型,而是一种称为char,*的数据类型,这个知识点我以后会讲到。
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, we certainly didn't know on day one how many times each of you was going to want to call get string, how many words a user might type when you call get string.
好的,当然我们不知道第一天你们,想要调用GetSting多少次,当你调用GetSting时,用户会输入多少单词。
应用推荐