Which symbol is used to begin a line comment in C?

2026

Which symbol is used to begin a line comment in C?

Answer: A. //ConceptComments are explanatory text that the C implementation removes during translation, so they do not become executable program statements. C provides…

  1. A.

    //

  2. B.

    /* */

  3. C.

    #

  4. D.

    --

Attempted by 33 students.

Show answer & explanation

Correct answer: A

Concept

Comments are explanatory text that the C implementation removes during translation, so they do not become executable program statements.

C provides line-comment syntax for text that continues to the next newline and block-comment syntax for text enclosed by paired delimiters.

Application

The token // starts a line comment. Every character after // on that source line is part of the comment until the next newline.

Contrast

  • The pair /* ... */ delimits a block comment and uses both an opening and a closing marker.

  • The symbol # introduces preprocessing directives such as #include.

  • The token -- is the decrement operator in C.

Result

Therefore, the symbol used to begin a line comment in C is //.

Explore the full course: Niacl Ao It Specialist

Loading lesson…