Program comments are explanatory statement that you can include in the C++ code that you write and helps anyone reading it's source code. All programming languages allow for some form and comments.
C++ supports single-line comment (//) and multi-line comments (/*...............................*/). All characters available inside any comment are ignored by C++ compiler.
C++ comments start with /* and end with */.
For example :-
/* This is a comment */
.* C++ comments can also
* span multiple lines
*/
A comment can also start with // , extending to the end of the line.For example:
#include <iostream.h>
main( )
{
cout << "Hello World"; // prints Hello World
return 0;
}
When the above code is compiled ,it will ignore //prints Hello World and final executable will produce the following results;
Output:-
Hello World
C++ supports single-line comment (//) and multi-line comments (/*...............................*/). All characters available inside any comment are ignored by C++ compiler.
C++ comments start with /* and end with */.
For example :-
/* This is a comment */
.* C++ comments can also
* span multiple lines
*/
A comment can also start with // , extending to the end of the line.For example:
#include <iostream.h>
main( )
{
cout << "Hello World"; // prints Hello World
return 0;
}
When the above code is compiled ,it will ignore //prints Hello World and final executable will produce the following results;
Output:-
Hello World
0 Comments:
Post a Comment