comments in c and c++

Posted under C++ Course On By mohammed.mutawe

comments in c

In C++, when dealing with large code, and publishing it to developers, we will need what is called Comment within our project in order to facilitate understanding of the code.

 

 

Comments types

There are other programming languages ​​that use the same C++ tags during commenting, and the method of commenting differs from one language to another. When working in code editors, the translator reads the entire code, ignoring the comment that are often limited to two boxes, and because the comment help us in analyzing and understanding the project, we will mention those The letters containing the heart of the comment are:

  • Two tags /* comment */: In C++, these are the most popular comment tags, which appear either in green or in red.
  • The mark here the comment //: It needs to be mentioned in each line when commenting, and you can distinguish it also in green or residential in the most famous editors.

 

Features and benefits of comment

  • It appears in a different color than the rest of the code.
  • You can write whatever you want inside, it is hidden from the work of translators.

 

Comments form

With this code, you will be able to distinguish between comments and codes.

#include<iostream>
using namespace std;

/*
    welcome to c++ language
*/

// 	welcome to c++ language


int main() {



    std::cout <<"Hello World"<< endl;


    return 0;
}

 

Please copy this code to notice the difference between comments and code.

 

Benifits of comments in c

It is no secret for us to mention the benefits of feedback among programmers:

  • Understand the code well.
  • Arrange and coordinate project files and list functions in each separate block.
  • An indispensable guide to explain the work of the code, without which it is difficult for us to analyze.

 

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *