Single Line Vs Multi line Comment : Difference



Difference Between Single Line and Multi line Comment ?

Multi-line CommentSingle-line Comments
Starts with /* and ends with */Starts with //
All Words and Statements written between /* and */ are ignoredStatements after the symbol // upto the end of line are ignored
Comment ends when */ OccuresComment Ends whenever ENTER is Pressed and New Line Starts
e.g /* This is Multiline Comment */e.g // Single line Comment

Comments in C :

Below are some of the examples where we can use different kinds of comments.Single line comment and multiple line comments can be

Hiding Code using Comments :

Single Line Comments are useful where you need to comment or hide two-three words however multiple line comments are useful where you want to hide multiple lines of code.

/*
for(i=0;i<num;i++)
 {
 printf("\nEnter the Number : ");
 scanf("%d",&arr[i]);
 }
*/

i.e Suppose we want to hide multiple lines then instead of using single line comment before each line we can use multiple line comment.

for(i=0;i<num;i++)
 {
 printf("\nEnter the Number : ");
 scanf("%d",&arr[i]);
 // i++; 
 }