C Multi Line Comment

In the previous chapter we have learnt about the the single line comment and in this tutorial we are going to learnt about the multiple line comments in c programming.

Multi Line Comment:​-
  1. Multi line comment can be placed anywhere.
  2. Multi line comment starts with /*.
  3. Multi line comment ends with */.
  4. Any symbols written between '/*'  and '*/' are ignored by Compiler.
  5. It can be split over multiple lines
Example for C Multi Line Comment:-
#include<stdio.h>
void main()
{
printf("Hello");
/* Multi
       Line
  Comment 
*/
printf("By");
}

In the above code we have written the multiple line comment in c code. In the below code we have marked the part which is ignored by compiler when we use multi line comment in c programming.

Different Ways of Using Multiple Line Comment :-

Way 1 : Used for Program Title and Documentation:-


/****************************************
  * Title : Program Name *
  * Author: Author Name *
  ***************************************/
Multi line comment can be used to show the author related information while writing the documentation notes. It is necessary to write the documentation information of the program to organize the multiple c files in big project
Way 2 : Used for More detailed comment inside program:-
/* following line is used to get -
   1.Count of the Customer 
   2.It is going to Return Integer
*/

int var = getCount(str);

OR
int var = getCount(str); /* Used to count 
                               Number of Persons
                                  Present */

pritnf("count : %d",var);

When our source code have complex or important step then it is important to write the multi line comment which can provide the necessary information about the complex statement
C Multi Line Comment  C Multi Line Comment Reviewed by ANAND PANDEY on 7:29:00 AM Rating: 5

No comments:

Created By Anand Pandey. Powered by Blogger.