C programming comment
Two types of comments are used in C program. In this chapter you will learn how to use the comments in C program.Comments are used in C programming to make the code more readable.
Typically, comments are used to write code documents.
Types of comments
There are two types of comments in C program
Single Line Comments
Multiple Line Comments
One Line Comment
One line begins with the comment //
// afterwards avoid any type of text in C compiler.
For example, the following example shows the use of comments in C program:
#include <stdio.h>
#include <conio.h>
void main () {
clrscr ();
// Use of print function
printf ("I Love C");
getch ();
}
Output
I Love C
You can also keep comments even after the statement.
printf ("I Love C"); // Use of print function
More than one line comment
More than one line begins with a comment / * and ends with * /.
Any type of text between / * and * / should avoid the C compiler.
For example, more than one line comment was used to understand the code in the following example:
#include <stdio.h>
#include <conio.h>
void main () {
clrscr ();
/ * Print function
Use * /
printf ("I Love C");
getch ();
}
Output
I Love C

0 Comments