How do you write a single-line comment in C?
2015
How do you write a single-line comment in C?
- A.
/* This is a comment */
- B.
# This is a comment
- C.
// This is a comment
- D.
-- This is a comment
Attempted by 2056 students.
Show answer & explanation
Correct answer: C
To write a single-line comment in C, use two forward slashes (//). Any text following // on the same line is treated as a comment and ignored by the compiler.