Comment is the code which is not executable means compiler will not compile the comments and that’s why comments are not visible on output screen.
Two types of Commenting:
Type 1: double slash ‘//’ method the whole statement after double slash is not executed by compiler
Example: try to run below code its output will be blank screen
#include <stdio.h> void main(){ // printf (“Hello World!”); } | #include<stdio.h> void main ( ){ //Comments // Comment printf (“Hello World!”);//abc } | #include<stdio.h> //Comments void main(){ //Comments printf(“Hello World”); } |
o/p: blank screen | O/p: Hello World! | O/p: Hello World |
In this way you can give multiple comments anywhere in the program but double slash is used to
comment only single line for commenting multiple lines use type 2.
Type 2: For multiline commenting or for commenting a whole paragraph from the program we have
to add /* at the start of comment and */ at the end of comment as shown in examples:
#include <stdio.h> void main(){ /* printf (“Hello World!”); printf (“Hello World!”); */ } | #include<stdio.h> void main ( ){ //Comments /* Comment*/ printf (“Hello World!”);//abc } | #include<stdio.h> /* Comments*/ void main(){ //Comments printf(“Hello World”); } |
o/p: blank screen | O/p: Hello World! | O/p: Hello World |
In above example at a time // and /**/ comments you can use in code.
Uses of Comments: Comments are optional in program but it is very helpful to write our own notes
inside the program just for our convenience.
Air Jordan 6'9 Double-Edge Razor - Jordan6Retro
ReplyDeleteCompare prices and authentic air jordan 13 shoes Online find an amazing price 룰렛 for the Air Jordan 6'9 kadangpintar Double-Edge Razor. (United States) at a low price. titanium metal trim Compare the top-rated brands Air Jordan 6 Retro