Comments in C Language
Comments
in C language are used to provide information about lines of code. It is widely
used for documenting code.
Fig: Comments In C Language |
There are 2 types of comments in the
C language.
1.
Single Line Comments
2.
Multi-Line Comments
1.Single Line Comments
Single
line comments are represented by double slash \\.
Program of single line
#include<stdio.h>
int main(){
//printing information
printf("Hello C");
return 0;
}
Output:
Hello
C
2.Mult-Line Comments
Multi-Line
comments are represented by slash asterisk \* ... *\. It can occupy many lines
of code, but it can't be nested.
Syntax:
/*
code
to be commented
*/
Program of multi line
#include<stdio.h>
int main(){
/*printing information
Multi-Line Comment*/
printf("Hello C");
return 0;
}
Output:
Hello
C
No comments:
Post a Comment