Comments in C

Comments serve as a sort of in-code documentation. When inserted into a program, they are effectively ignored by the compiler; they are solely intended to be used as notes by the humans that read source code.Comments are especially important in large type of projects containing thousands of lines of source code or in projects in which many contributors are working on the source code.

Types of Comments

There are 2 types of Comments in c language.

  1. Single Line Comments
  2. Multi Line Comments

1. Single Line Comments

C introduced a double slash comment prefix // as a way to comment single lines. The following is an example of this

// Site: tutorial44.com
#include 
int main() {
   // Print tutorial44 (Single Line Comments)
   printf("tutorial44 \n");
   
   return 0;
}

2. Multi Line Comments

Multi line comments are used to add a detailed description about the code. It begins with slash asterisk /* character and ends with */. Characters between /*.....*/ are treated as comments.

/* Site: tutorial44.com
multi line comments */
#include 
int main() {
   /* Print tutorial44 
   This is a Multi line comments */
printf("tutorial44 \n"); return 0; }