C++ Comments

Hi everyone, inside this article we will see about C++ Comments.

In C++, comments are used to provide annotations and explanations in the code. They are ignored by the compiler and do not affect the execution of the program.

Types of Comments

There are two types of comments in C++:

Single-line comments

Single-line comments start with // and continue until the end of the line.

For example:

// This is a single-line comment

Multi-line comments

Multi-line comments start with /* and end with */. They can span multiple lines.

For example:

/* This is a 
multi-line comment */

Comments are an important tool for documentation and making the code more readable and maintainable. They can be used to provide explanations of the code’s purpose, algorithm, or important decisions made during the implementation.

We hope this article helped you to understand about C++ Comments in a very detailed way.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.