So I'm going to comment those out, and let's go down to this piece of code, and uncomment it.
那么我会把这些注释上,让我们看看这段代码,取消注释。
In general, good programming style says you put in comments that are going to be valuable in helping you as a reader understand what's going on inside of the code.
通常来说,优秀的编码风格意味着,你要放进去的注释,在帮助代码阅读者,理解代码内部,是怎么工作的。
Your copies realize have comments that document everything that's going on.
你们的拷贝的注释,记录了代码做的所有事情。
OK, let me comment this out, and let's look at this next little piece of code. All right.
好,让我添加一点注释,然后让我们看看,下面的一些代码,好。
Notice what this does. Certainly the heart of it, right in here, is still the same thing.
注释代码进行的操作,当然代码的核心,也就是这里。
If you can read the code a year later, even code you wrote yourself, it's a good sign that you put good comments in, right?
如果你还能读懂1年前的代码,就算是你自己写的代码,这也说明了你放进去的注释,已经非常好了,对不对?
Give you some examples. What have we talked about? We've talked about things like using comments to highlight what you're doing in the code, to make it easier to debug.
给大家举些例子,我们一直在强调什么来着?,我们讲过要用注释来说明,你在代码中进行的操作,以便于调试。
Because as you'll soon find, when you're writing programs 0 that aren't just four lines long but are 40 or 400 which very quickly becomes easy, you'll find that even you the next morning have no idea what this code does for whatever reason, and just having some English comments is a huge boon to comprehension for yourself and others.
你们自己写程序时就会发现,用40行甚至400行代码来代替繁杂拥挤的4行代码0,将会让事情简化许多,你会发现,即使由于某些原因,你不知道如何写代码,先写些注释,于人于己,都是好事,易于理解嘛。
It's words to you, or to the reader of the code, that are telling you what's going on inside of this code. OK?
注释是一些对你,或者对代码阅读者说的一些话,告诉你这段代码,是干什么的,对不对?
It could be, what's the intuition behind this piece of code.
注释可以是,在这片代码后面,直觉是什么是。
And in fact, if we just go ahead and run this now, hopefully we get out-- oops, sorry, I'm going to have to change this quickly, I still have some things uncommented at the bottom, yeah, there they are, I don't think we need that yet, all right, we will comment those out.
如果我们现在去运行程序的话,希望我们会得到-噢,抱歉,我得去马上,改下代码,还有一些在底部的东西没被注释掉,对,就在这儿了,我不认为我们需要,这些东西了,好,我们把它们注释掉,好,那么我为什么要讲这些呢?
So let's take a look then at somewhere where this is actually a useful thing to know so this is compare1.c. So, in compare1.c I've stripped out the comments in my version but in your version you do have comments for reference and it's actually pretty self-explanatory if you just read through the code.
那么再然我们看一看,一些有用的东西,这是compare1。c,所以在compare1。c中,在我的版本中,我吧注释去掉了,但是在你们的版本中是有注释的,这是相当容易理解的,如果你通读这段代码。
应用推荐