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
- 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.