A block comment in C is a lexical construct used to instruct the preprocessor and compiler to ignore an arbitrary span of source text. It is delimited by specific character sequences and can span multiple lines or exist inline within a single statement.Documentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
Syntax
A block comment begins with the forward-slash asterisk sequence/* and terminates with the first subsequent asterisk forward-slash sequence */.
Lexical Rules and Compiler Behavior
- Token Replacement: During translation phase 3 of the C compilation process, the preprocessor replaces the entire block comment (including its delimiters) with a single space character. Consequently, block comments cannot be used to concatenate adjacent tokens.
- String Literals and Character Constants: The
/*and*/character sequences lose their special meaning when enclosed within string literals (" ") or character constants (' '). The compiler treats them as standard character data rather than comment delimiters.
- Line Splicing: If a line splice (a backslash
\immediately followed by a newline) occurs within a block comment, the compiler processes the splice during translation phase 2, prior to parsing the comment delimiters.
Nesting Constraints
Standard C strictly prohibits the nesting of block comments. The lexical analyzer terminates the comment at the very first*/ sequence it encounters, regardless of how many /* sequences preceded it. Attempting to nest block comments exposes the remaining text to the compiler, typically resulting in a syntax error when it attempts to parse the trailing, unmatched */.
Master C with Deep Grasping Methodology!Learn More





