Comments in C

Spread the love

Comments are ignored by the compiler. We write comments to provide information and better understanding of the program or about lines of code.

There are two ways in which we can write comments in C program

  1. Using //:- This is used to write a single-line comment.
#include<stdio.h>    
int main(){    
    //printing Hello  World   
    printf("Hello World");    
return 0;  

2. Using /* */:- The statements enclosed within /* and */ , are used to write multi-line comments.

#include<stdio.h>    
int main(){    
    /*printing Hello World 
       printf() function is used for print the given statement*/  
    printf("Hello World");    
return 0;  
}      

** We cannot have comments within comments.

Disclosure: This website is supports by its reader. This means, if you buy any product / service through link on this website, we may earn a small commision withought costing you extra. Learn how you can support Us and why we need this?