Comments are added to make a program more readable but the compiler must ignore them The slash/star(/* ..*/) combination is used in C for comment delimiters Please note that the program does not illustrate good commenting practice, but is intended to illustrate where comments can go in a program. It is a very sloppy looking program.
The first slash star combination introduces the first comment and the star slash at the end of the first line line terminates this comment. Note that this comment is prior to the beginning of the program illustrating that a comment can prccede the program itself. Good programming practice would include a comment prior to the program with a short
introductory description of the program. The next comment is after the main() program entry point and prior to the opening brace for the program code itself. The third comment starts after the first executable statement and continues for four lines. This is perfectly legal because a comment can continue for as many lines as desired until it is terminated. Note carefully that if anything were included in the blank spaces to the left of the three continuation lines of the comment. It would be part of the comment and would not be compiled. The last comment.it would be part of the comment and would not be compiled. The last comment is located following the completion of the program. illustrating that comments can go nearly anywhere in a C program.
Experiment with this program by adding comments in other places to sec what will happen. Comment out one of the print statements by putting comment delimiters both before and after it and sec that it does not get printed out.
Comments are very important in any programming language because you will soon forget what you did and why you did it. It will be much easier to modify or fix a well commented program a year from be much easier to modify or fix a well commented program a year from now than one with few or on comments. You will very quickly develop your own personal style of commenting. Some compilers allow you to nest comments which can be very handy if you need to comment out a section of code during debugging; check your compiler documentation for the availability of this feature with your particular compiler.
Good formatting style
Here is an example [GOODFORM.C] of a well formatted program:
Page 813-7