Too many comments are much worse than totoo few. They take time to write, and even more time to maintain. Throughout the life of a project, code will always reflect what the program does, comments will be inaccurate the instant the code changes. Once the intent to the code does not match the comment, you are on a slippery downhill slope. Comments are not tested by complierscompilers for correctness, so incorrect comments cannot be detected and corrected by the programmer unless huge amounts of attention to detail, where it makes little difference, is made.
In my experianceexperience new programmers often overcomment code with useless comments that add no value. Extreme cases such as this are common
int x ; // Integer x // Copy the string bob into fred making sure not to overflow the buffer. strncpy(bob, fred,sizeof(bob)); (The error is intentional to make a point)
However devs putting in too few comments is just as common......