Multi-line Comment in C

The Multi-line comment in C starts with a forward slash and asterisk ( /* ) and ends with an asterisk and forward slash ( */ ). Any text between /* and */ is treated as a comment and is ignored by the compiler.

It can apply comments to multiple lines in the program.

Syntax of Multi-Line C Comment

/*Comment starts
    continues
    continues
    .
    .
    .
Comment ends*/

Example 2:  C Program to illustrate the multi-line comment

C




/* C program to illustrate
use of
multi-line comment */
#include <stdio.h>
int main(void)
{
    /*
    This is a
    multi-line comment
    */
   
      /*
    This comment contains some code which
    will not be executed.
    printf("Code enclosed in Comment");
    */
    printf("Welcome to w3wiki");
    return 0;
}


Output: 

Welcome to w3wiki

 



C Comments

The comments in C are human-readable explanations or notes in the source code of a C program.  A comment makes the program easier to read and understand. These are the statements that are not executed by the compiler or an interpreter.

It is considered to be a good practice to document our code using comments.

Similar Reads

When and Why to use Comments in C programming?

A person reading a large code will be bemused if comments are not provided about details of the program. C Comments are a way to make a code more readable by providing more descriptions. C Comments can include a description of an algorithm to make code understandable. C Comments can be used to prevent the execution of some parts of the code....

Types of comments in C

In C there are two types of comments in C language:...

1. Single-line Comment in C

A single-line comment in C starts with ( // ) double forward slash. It extends till the end of the line and we don’t need to specify its end....

2. Multi-line Comment in C

...