C Language // delimited comments


Example

C99

C99 introduced the use of C++-style single-line comments. This type of comment starts with two forward slashes and runs to the end of a line:

// this is a comment

This type of comment does not allow multi-line comments, though it is possible to make a comment block by adding several single line comments one after the other:

// each of these lines are a single-line comment
// note how each must start with
// the double forward-slash

This type of comment may be used on its own line or at the end of a code line. However, because they run to the end of the line, they may not be used within a code line

// this comment is on its own line
if (x && y) { // this comment is at the end of a line
    // this comment is within an if, on its own line
}