C Comments

Comments are the non-executable code used to provide documentation for the C program. Comments provide details about the code so that other users can easily understand the code by reading those comments.

In C Language, comments are beneficial especially for large programs. C Comments can occupy more than one line but cannot be nested.

Types of Comments

  1. Single Line Comments
  2. Multi Line Comments

1. Single Line Comments in C

Single Line Comments are used to comment out just Single Line in the Code. It is used to provide the Description of line.


Single line comments are represented by double slash //.
The syntax for a Single comment is:
// Single Line comment will be written here

Example of Single Line Comment in C

Let’s see an example of a single line comment in C.

Run : http://ideone.com/Zh4906

2. Multi Line Comments in C

In multi line comments, we can insert the comment description of many lines. It can be placed anywhere in the program. Multi-line comment starts with /* and ends with */.


The syntax for a Multi Line comment is:
/* Multi Line comment will be written in between this */

Example of Multi Line Comment
Run : http://ideone.com/Zh4906

Congratulations! Chapter Finished. Do you want to practice more?
Exercises & Assignments
  • No Content Found.
  • Interview FAQs
  • No Content Found.