Sunday, August 2, 2009

How will i master c programming commenting???

Do you mean commenting C programs? Like documenting them?


In that case, a rule of thumb is that the more comments you need for the code to make sense, the worse it is. Good code is self documenting, you can see what it does at a glance because of good variable names and clean design. But most code will need *some* comments at least. Comment about general behaviour, write what the code is doing, and don't duplicate the code in the comments.


i++ // increment i


is useless.

How will i master c programming commenting???
Umm, watch videos or read a guide? Although C programming would take a while with a guide.
Reply:Every function should have a comment saying what it does unless it's really really obvious from the name of the comment (double divideNumberInHalf(int n) probably doesn't need one unless it's doing something fancy like dividing then rounding or something).


No comments:

Post a Comment