Thursday, April 7, 2016

Comments in C++

Comments in C++


Comments make programming simple.

comments c++

They not only help us to understand a piece of code written by some one else better but also help in writing ones own program specially in large programs where one needs to keep track of what’s going on. Comments help in increasing the program readability and increase program’s maintainability. In C++ comments can be given in two ways:
a) Single line comments:

They start with // (double slash) symbol and terminate at the end of the line.

For example .:  

int a ; // declares the variable ‘a’ of integer type


b) Multi line comments:

 Start with a /* symbol and terminate with a */ symbol.

For example,

           /*  This is a multi line  comment */

No comments:

Post a Comment