O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Comments

Documenting code is one of the most important parts of the programming process and takes very little effort to do well. The C language, like most others, provides a facility to write plain English in the code but specify that it should be excluded from the compiler process.

As a programmer, you are telling the compiler that these words are for you, not for the compiler, so please ignore them. Good comments detail what code does and why it was written. The more (good quality) comments, the better. There are three main reasons that extensive comments are a good idea:

  • To refresh you when you read it again to make changes.

  • To help future programmers looking at the code.

  • To help when you come back to optimize.

One of the mistakes programmers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required