What is the use of comments in c++ | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

What is the use of comments in c++

6th Jun 2018, 10:02 AM
Shobhit Jaiswal
Shobhit Jaiswal - avatar
7 Respostas
+ 16
Hey Shobhit Jaiswal, Comments are explanatory statements that you can include in the C++ code to explain what the code is doing. The compiler ignores everything that appears in the comment, so none of that information shows in the result. A comment beginning with two slashes (//) is called a single-line comment. The slashes tell the compiler to ignore everything that follows, until the end of the line. https://www.sololearn.com/learn/CPlusPlus/1605/
6th Jun 2018, 10:51 AM
***
+ 1
You can write notes in the code so others can understand your code. A comment does not affect a code. It is only a comment.
6th Jun 2018, 10:45 AM
Fabio Rocha
Fabio Rocha - avatar
+ 1
Comments are used to indicate what is going on the particular line of the code. For e.g. average (a,b,c); //function calling Here, //function calling is the comment of the code and indicates that a function is being called.
6th Jun 2018, 10:45 AM
Rafey Iqbal Rahman
Rafey Iqbal Rahman - avatar
0
Thanks Brothers
7th Jun 2018, 1:52 AM
Shobhit Jaiswal
Shobhit Jaiswal - avatar
0
I'm sorry what was the question again
9th Jun 2018, 6:53 PM
alice
0
alice The question is "What is the use of comments in c++"
10th Jun 2018, 7:17 AM
Rafey Iqbal Rahman
Rafey Iqbal Rahman - avatar
0
Comments are the statements that are ignored while compiling. C++ supports both single line and multi line comments. You can use, the following methods to comment in c++: 1. Use // before a line and the compiler will understand that it is a comment. 2. Use /* sololearn */ and place the line instead of sololearn to make it a comment. If you want to understand comments further, read this https://www.tutorialspoint.com/cplusplus/cpp_comments.htm
12th Dec 2023, 12:27 PM
Swadin
Swadin - avatar