Introduction to Comments in C++

 Remarks in C++ programming language





A remark is text that the compiler overlooks yet that is significant for designers or developers. Remarks are customarily used to make sense of code for future reference. The compiler views them as clear region. You can include remark in testing to make explicit lines of code inactive; anyway, #if/#endif preprocessor mandates end up being better for this since you can envelop code that contains remarks anyway you can't settled remarks.


A C++ remark is written in one of the accompanying ways:


1. The/* ( cut, reference mark ) characters, trailed by any progression of characters ( involved new lines), trailed by the */characters. This grammar is identical to ANSI C.


2. The//( two slices ) characters, trailed by any gathering of characters. A different line not immediately gone before by a slanted punctuation line closes this sort of remark. Along these lines, it is normally called a "singlr line remark ."


3. The remark characters (/* , */, and//) incorporate no phenomenal importance significance inside a person steady , string severe, or remark . Remark using the first language structure. Along these lines, Remark can't be settled.


Sorts of Remarks:


There are two sorts of remarks in C++ Programming language :


  1. Single line remark
  2. Multi-line remark



Single line Remark:


Tended to as(//) twofold forward cut


It is used to mean just a single line remark. It applies remark to a one line in a manner of speaking. It is insinuated as C++ style remarks as it is at first fundamental for C++ programming language.


For example:


// single line remark


Multi line remark:


Tended to as/* text to be remarked */start with forward cut and indicator (/* ) and end with reference mark and forward cut ( */) .

It is used to connote multi line remark. It can apply remark to more than a one line.

For example:


/* Beginning of Remark


proceeds


proceeds


.


.


.


.


.


finishing of Remark */


Remark at End of Code Line:


You can likewise say something that looks close to the completion of a line of code. Regardless, generally its a better practice than put the remark before the line of code.


For example:


 int name ; //name of the substance


When and why we use Remarks ?


  • A singular substance examining or perusing a tremendous code will be occupied that remarks are not given about subtleties of the program.
  • Remarks are a strategy for making a code all the more straightforward by giving more portrayal.
  • Remarks can consolidate a portrayal of a calculation to make code reasonable.
  • Remarks can be valuable for one's own self too if code is to be reused after quite a while.


I want to believe that You can undoubtedly Comprehend and Realize this Article


Good luck 😇

Post a Comment

0 Comments