What are code comments?

Code comments are a way to describe what a line, or several lines of code are doing.

Comments are not excuted by the complier.

It’s generally a good practice to add comments to your code, it will help you understand it in the future. And will aid your colleagues in understanding what the logic does.

They can also be used to tell the compiler not to excute some lines.

In most programming languages, comments can be written by adding “double slashes” then the comment.

You can also do multi-line comments by surrounding your comment with “/*”.

This is an example comment:

//prints "Hello World" to the console.
cout << "Hello World"; 

/* cin >> name;
   cout << name; */

Comments

4 responses to “What are code comments?”

  1. ahinrihudur Avatar

    Way cool! Some very valid points! I appreciate you writing this write-up and also the rest of the site is also
    really good.

  2. PUBLINANAR Avatar

    It’s hard to come by well-informed people on this subject, but you seem like you
    know what you’re talking about! Thanks

  3. PUBLINANAR Avatar

    Heya excellent blog! Does running a blog similar to this take a massive amount work?
    I’ve very little expertise in computer programming but I was hoping to start
    my own blog soon. Anyway, if you have any suggestions or tips for new blog owners please
    share. I know this is off subject but I just had to ask.
    Cheers!

  4. MINIJAIN Avatar

    Hi there friends, good article and pleasant arguments commented
    at this place, I am really enjoying by these.

Leave a Reply

Your email address will not be published. Required fields are marked *