Use of comments in C++
Program comments are explanatory statements that you can include in C++ code that you write and helps anyone reading its source code. All programming languages allows for some form of comments.
C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compilers.
C++ comments start with /* and end with */. For example:
Use of comments in C++
Program comments are explanatory statements that you can include in C++ code that you write and helps anyone reading its source code. All programming languages allows for some form of comments.
C++ supports single-line and multi-line comments. All characters available inside any comment are ignored by C++ compilers.
C++ comments start with /* and end with */. For example:
/*This is a comment/* /*C++ can also *use *multiple *lines. /*
A comment can also starts with // and it will be typed at the end of the line.
For example:
#include <iostream> using namespace std; int main(){ cout<<"Hello World"; //This is a comment return 0; }
When the above code is compiled, it will ignore // This is a comment and final executable will produce the following result:
Leave a comment