What is comment in C?
In C, a comment is a piece of text in code that is not executed when the program is executed.
Comments are used to provide explanations, and keep documentation, or notes within the code for future reference and code understanding.
C supports two types of comments: single-line comments and multi-line comments.
Lines between /* and */ is treated as multi-line comments by C compiler.
Adding multi-line comments in C
To create a multi-line comment, add /* to begin a multi-line comment and */ to end it.
In the following example, the multiple lines is placed between
This is an example
of multiple lines
comment in C
/* and */. It creates a multi-line comment. C compiler will ignore the lines as comment and it will not have any effect on the execution of the program.
Example of C Multi-line Comments
Output of the above example
Use /* to begin a multiple lines comment and */ to end it.
The output does not contain the commented lines.