Basics of C Programming

⯈Basic C Programs

Comments in C

Comments are the statements which are ignored by the compiler. (A compiler is a system software, which converts high level language to machine language). We write comments for human understandable purpose. There are two types of comments:

  1. Single line comments.
  2. Multi line comments.

Single line comments

These types of comments span over single line. They are written starting with “//

Example 1:

//This is a comment.

Example 2:

//This is also

//a comment

Example 3:

//This is not

a comment

Because the second line doesn’t begin with //


Multiline comments

These types of comments span over multiple lines. They begin with /* and end with */.

Whatever is written between /* … */ is a multiline comment.

Example 1:

/* This is a comment */

Example 2:

/*This is also

a comment */


Note: Multi-line comments cannot be nested. It means there cannot be one multiline comment within another.


/* This is an /*Error*/ */

Scroll to Top