What is the practical use of comments? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the practical use of comments?

24th May 2017, 4:46 AM
Vishwas Mishra
Vishwas Mishra - avatar
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; }
24th May 2017, 4:58 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
documentation, explanation, separation of the code they're also used for debugging
24th May 2017, 4:49 AM
Mario L.
Mario L. - avatar
+ 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.
24th May 2017, 4:50 AM
Balaji Natarajan
Balaji Natarajan - avatar
+ 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
24th May 2017, 7:12 AM
‎ɐısıօլɐ
‎ɐısıօլɐ - avatar
+ 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.
24th Feb 2019, 4:41 AM
Kiddo
Kiddo - avatar