← The C Language Lesson 5 of 77 · 10 XP

Comments

Theory and problem statement

Machine translation, not yet reviewed by a native speaker.

C has two kinds of comments:

// single-line — to the end of the line (since C99)

/* multi-line:
   everything between the asterisks
   is skipped by the compiler */

Multi-line comments can't be nested: the very first */ closes the comment.

/* outer /* inner */ and this is already code! */   // error

That's why it's handier to "switch off" big chunks of code with the preprocessor:

#if 0
    this code won't be compiled,
    even if it contains /* comments */
#endif

A good comment explains why, not what: i++; // increase i is useless, while // skip the CSV header is useful.

Task. The program prints three lines. Comment out the second one so that only one and three appear on the screen.

Sign up for free to solve this task right in your browser: code editor, running, test checks and hints.