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; */
Leave a Reply