C Program to Find Total of Even Integers

C Comments

C programming Comments are way of inserting remarks and reminders into a program without affecting its content. C Comments do not have a fixed place in program: the compiler treats them as though they were white space or blank characters and they are consequently ignored.

Programs can contain any number of comments without losing speed. This is because comments are stripped out of a source program by the compiler when it converts the source program into machine code.

Comments are marked out or delimited by the following pairs of characters:

Example,

/* ...... comment ......*/

Comments are used by the programmer as a documentation aid. The aim of documentation is to explain clearly how the program works and how it is to be used. Sometimes C comment contains an informal argument demonstrating the correctness of the program.

C Comments with Examples

C Comments should be written simultaneously with program text. Although some programmers insert comments as a last step, there are two problems with this approach. The main reason because comment is skipped over as though it were a single space, it can be placed anywhere where spaces are valid characters, even in the middle of a statement, though this is not to be encouraged.

The following illustrates one of many styles that can be used to highlight comments:

*****************************
* If you visit Technosap *
* put comments in a box. *
*****************************

We should try to minimize the use of comments in program while trying to maximize the readability of the program. If there are too many comments, you obscure your code and it is the code which is the main message in a program.

Example,

main () /* The almost trivial program */
{
/* This little line has no effect */
/* This little line has none */
/* This little line went all the way down
to the next line */
/* And so on ... */
}

Example :  Hello World Program with Comments


The second is that ideally the C comments should serve as running commentary, indicating program structure and contributing to program clarity and correctness. They cannot do this if they are inserted after the coding is finished.