oter

Comments are used to document code for clarity from "summary" of C Programming Language by Brian W. Kernighan,Dennis Ritchie

Comments are used to document code for clarity. Comments can clarify the intent of the code so that others (or yourself) can understand it more easily. Good comments can save hours of frustration and debugging. There are two ways to insert comments in C programs. The first method uses the /* and */ delimiters, which can extend across line breaks. The second method uses the // delimiter, which terminates at the end of the line. It is essential to keep comments up to date. If you change the code, update the corresponding comments. Comments should be clear, relevant, and concise. Over-commenting can be as harmful as under-commenting. A good rule is to write comments that explain things that the code cannot. Comments should not just restate the code in a different form. It is better to write clear code and eliminate the need for comments whenever possible. The practice of writing comments can also help clarify your thinking about the program. By explaining your code in comments, you may discover logic errors or other issues. Remember that comments are for people, not computers. Avoid using comments to explain what the code does; instead, use comments to explain why the code does what it does. Keep comments short and to the point. Be consistent in your commenting style throughout the program. A well-commented program is more likely to be maintained and improved over time. In summary, comments are a valuable tool for enhancing the clarity and maintainability of code.
    oter

    C Programming Language

    Brian W. Kernighan

    Open in app
    Now you can listen to your microbooks on-the-go. Download the Oter App on your mobile device and continue making progress towards your goals, no matter where you are.