Comments in C++

 Comments in C++ :

Comments are nothing but 'Information'.




Comments are used to describe the code and to make it more readable.


Comments are of Two types :

      1.Single-line Comment

      2.Multi-line Comment


Single-Line Comments:

Single-line comments start with two forward slashes (//).

 Example:

 #include<iostream>  
   using namespace std;  
    int main()  
    {  
      cout<<"Hello World"<<endl;  //Prints Hello world(This is Comment)  
    }  

  

Multi-Line Comments:

Multi-level comments start with /* and ends with */.

Any text between /* and */ will be ignored by the compiler:

Example:  

 #include<iostream>  
 using namespace std;  
 int main()  
 {  
 cout<<" Hi Hello"<<endl;  
 /* The code above will print the words Hi and Hello  
 to the screen, and it is amazing */  
 }  


AUTHOR : Rakshit Joshi [ Linkedin Profile ]

For Videos Join Our Youtube Channel: Join Now