Tuesday 7 July 2015

What is Comment in C++ ?

comment Comment is non executable Statement in the C++.

Types of Comments:

                                             Two Types :
                                                             1. Single Line Comment
                                                             2. Multiple Line Comment

Single Line Comment:

                                            For Example:
cout<<"Hello Friends."<<endl;                                       //Print Hello Friends.
cout<<"ceplusplustutorials.blogspot.com";                 //website
cout<<"M.Rizwan Aslam";                                              //Creater
  • Single Line comment starts with "//" symbol.But more  dashes "////////" can also be used.Minimum 2 dashes require.

Multiple Line Comment:                       

                                           For Example:  

void main(){

     /*     this comment
                  can be considered
                              as
              multiple line comment     */

cout<<"Hello Friends."<<endl;
getch();
                     
}
  • Multi Line comment starts with "/*" symbol.
  • Multi Line comment ends with "*/" symbol.

No comments:

Post a Comment