And if you're our zero just continue standing there awkwardly, Alright. So with that said, we have a three-letter word so we'll have three rounds of hands going up or down.
如果你代表0,就站在那里别动,好,那么,我们有三个字母的单词,因此我们分三次分别表达这三个字母。
If you can figure out why fails on three letters instead of 12, you'll be more than half way to solving the problem.
如果你能明白为什么程序,在输入三个字母的单词的时候没法运行,你就已经解决了问题的一半了。
Its name is malloc for memory allocation and what malloc does for us is we say, hmm, the user has typed in a three-letter word.
它为我们分配内存地址,它为用户输入的3个字母单词,分配地址。
So if your word game doesn't work when the words are 12 letters long, instead of continuing to debug 12 letter hands see if you can make it fail on a three letter hand.
因此如果你的单词游戏当输入单词,有12个字母的时候没法运行了,看看输入三个字母的单词它,能不能正常运行吧。
D-A-V-I-D Well, if I've got a five-letter word like D-A-V-I-D, well, that's like five bytes and yet we only have the ability thus far in this class to return one thing at a time I can't return five bytes to you, but wait a minute, those bytes by nature of a computer are just stored in RAM.
好的,如果有5个字母的单词,如,那是5个字节,我们只能返回一个东西,而不能返回5个字节,等一下,这些字节被计算机本能地,存储在内存中。
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.
它为我们做了这些事情,这样我们就可以,通过第一个字节的地址,它还可以通过包含一个特殊的值,来保证在哪里停止,如果你输入了一个三个字母的单词,就可以获得那个字符串,不管怎样,我们分配四个字节,因为我们在末端需要一个额外的字节,来保存这个特殊的标志值--反斜杠。
s2 So, I'm passing in the first character in s2, I'm making it uppercase and then I'm putting it back so casually speaking this is just capitalizing the first letter of whatever word the user typed in to s2.
那么,我把第一个字符传递给,我把它转换成大写的,然后存下来,简单说,这就是把用户输入s2中的单词,的第一个字母转换成大写的。
应用推荐