C++ Programming


C++ Comments tutorials
-
Comments are an important part of any program, it is usally written to write remarks and extra information about program, so that reader can understand what the program is about. Compiler ignores comments.
-
There are two types of comments in C++ Programming language.
-
Single line comment.
-
Multi line comments.
Single line comment
-
Single line comments is accomplished by double-slash (//).
-
Everthing that is followed by double-slash till the end of line is ignored by the compiler.
-
It is reffered as C/C++-style comments as it is originally part of C/C++ programming.
start with double slash symbol (//) and terminate at the end of the line.
Example:
// This is my first C++ program and this line will be ignored by compiler.
Multi line comment
-
Multi-line comments starts by using forward slash followed by asterisk (/*) and ends by using asterisk followed by forward slash (*/).
-
Everthing between (/*) and (*/) are ignored by compiler whether it is one or more than one line or a block of code.
-
It is reffered as C-Style comment as it was introduced in C programming. But later on this comments where added in C++.