So in this lecture we're going to discuss commenting.
Up until this point I haven't discussed commenting because I've been wanting to get most of the hottest
stuff out of the way so commenting allows you to basically write comments for yourself to make code
a little easier to understand.
So for example this is a comment.
So by using two forward slashes you say to the compiler.
This entire line is not code.
It's a comment for myself to understand my code better and the compiler won't compile this if you did
slash slash integer acres 50.
It doesn't get compiled as a comment.
So that's one type of comment.
You can.
You can use new lines too.
You can use forward forward slash to forward slashes and then a description of what's going on.
That's one way to do it.
But what if you want to write multiple lines maybe a paragraph.
Well to do that you can do this.
Everything here is a comment and here.
So forward slash ask Iris to stop the multi line comment.
These are called multi line comments.
Now everything else is your comment and then you end the comment with an asterisk forward slash.
So to stop the comment forward slash asterisk to end the comment asterisk.
Forward slash.
And then that is how you can write comments for yourself.
And it is great for things like commenting functions you can like you can put something here and you
can say uh this is the entry point to our application something like that.
And it's much more easier to understand and e you can actually put in things like this
and what this does is it's still just a comment.
But if you put this through some sort of documentation genuine generator it will actually take these
and it will put it into the documentation and automatically create a documentation for you.
So you can look into projects called Doc surgeon and docs surgeon basically does this.
It will create a Web site for you based on your programming project.
So what you will do you will basically tell oxygen that.
Here are my C files and then it will go through it will grab all the functions that you have.
It will put them into the Web site and then it will look for these comments here.
But it's important to note many of these generators expect to ask for asterisks to start the comment
and not one now in C..
You only need one to start it.
But the actual parts of the documentation generator looks for two of these in most cases.
So then it will come through it will see this and it will say OK this is a description of function main
and these are the arguments descriptions of function main and then it will build you all of this hate
GMR Web site so that people who are using your project can go through and see everything nicely explained.
So that's something to look into that's oxygen.
So they are the two comments in C.
So once more.
Forward forward slash is for new it is for one line comments
forward slash star star forward slash is for multi line comments multi line.
OK so I hope that explains commenting commenting is great because it can help explain your code to other
developers who are working on the project and it's a good reminder for yourself while good coach should
usually be self-explanatory insert in many scenarios you will need to comment especially for complicated
code.
Thank you.