+ 3
What is the practical use of comments?
5 Answers
+ 10
You can also comment our parts of code which you have to fix, prior to compiling the program and testing current features. E.g
int main()
{
ValentinHacker obj;
// obj.test_func(2)
cout << "Cookies";
return 0;
}
+ 4
documentation, explanation, separation of the code
they're also used for debugging
+ 4
Once you write a program and come back to it after few days, it will be a stranger to you. To reduce that delay in understanding what the program statements do, you need comments.
+ 2
since I'm a student I always write comments for myself, I mark places where the code is off and mistakes happen, I write explanations and also it's amazing for debugging, just commenting out parts of the code to see what works and what doesn't
+ 1
Organizing your code and pointing out what some functions do if what happens when the code in a section is executed. I use comments all the time no matter what language.