Comment in C / C ++
Program comments are interpretations, which you can include in C / C ++ code, and make it easier for anyone to read the source code. All programming languages allow certain comments.
The comment of the program is the explanation of the code writer in C / C ++ code, helping the reader, checking the source code is easier to understand. All programming languages have their own syntax for commenting.
C ++ supports single-line and multi-line comments. All characters in the comment are ignored by the C / C ++ compiler.
Comment in C / C ++ starts with / * and ends with * /. Below is an example of a single-line comment and multi-line comment in C ++:
/* Day la mot comment don dong */ /* C/C++ cung ho tro cac comment * trai dai tren nhieu dong */
A comment can also start with //, extending to the end of the line. For example:
#include using namespace std; main() { cout << "Hoc C/C++ co ban va nang cao"; // In dong chu Hoc C/C++ co ban va nang cao return 0; }
When the above code is compiled, it will skip // Print C / C ++ and get high results and finally give the following result:
Hoc C/C++ co ban va nang cao
Inside the comment / * and * /, the characters // have no special meaning. Inside the // comment, the characters / * and * / have no special meaning. Therefore, you can "nest" these two types of comments together. For example:
/* Comment ve dong lenh in dong chu Hello World: cout << "QTM xin chao cac ban!"; // in dong chu QTM xin chao cac ban! */
According to Tutorialspoint
Previous article: Basic C ++ syntax
Next lesson: Data type in C / C ++
You've just finished reading the article "Comment in C / C ++" edited by the TipsMake team. You can save comment-in-c-c-.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.
- How to comment with a gif on Instagram
- Youtube links comments to Google+ with many good features
- How to comment with timelines on YouTube
- 5 ways to reduce spam comments on Wordpress Blog
- How to export Facebook Fanpage comment into Excel file
- How to hide comments on Facebook with keywords
- How to Tag your friends to comment, comment on Facebook
- Instructions to turn on 'Rating comments' for posts on Facebook
- How to Comment on YouTube
- How to insert pictures into an Excel comment box
- How to Comment with Timeline on YouTube
- How to create an automatic comment filter on YouTube
- How to Insert a Comment Box in Word, PowerPoint, and Excel
- Beware of These 5 YouTube Comment Scams!