The best C ++ comments Tutorial In 2024, In this tutorial you can learn C ++ comments
Program notes are explanatory statement, you can include comments in C ++ code, which will improve the readability of source code. All programming languages allow some form of comments.
C ++ supports single-line and multi-line comments. Note that all characters will be ignored by the C ++ compiler.
C ++ comments begin with / * in * / Termination. E.g:
/* 这是注释 */ /* C++ 注释也可以 * 跨行 */
Notes can also start with //, until the end of the line so far. E.g:
#include <iostream> using namespace std; main() { cout << "Hello World"; // 输出 Hello World return 0; }
When the above code is compiled, the compiler will ignore// prints Hello World, will eventually result in the following:
Hello World
In / * and * / inside a comment, // the character has no special meaning. // In the comments, / * and * / characters have no special meaning. Therefore, you can nest another comment in the annotator. E.g:
/* 用于输出 Hello World 的注释 cout << "Hello World"; // 输出 Hello World */