Vidyalelo
C Programming · Q16

C Fundamentals

Programming · C Programming · question 16

Q16

Which character is used to represent a comment in C code?

A.
#
B.
//
Answer
C.
/*
D.
;

Answer: Option B

Solution

Answer: Option B
Solution:
The character used to represent a comment in C code is Option B: //. In C, the double forward slash (//) is used to begin a single-line comment. Comments are used for adding explanations or notes within the code that are ignored by the compiler and are solely for human readability.

So, the correct answer is:
Option B: //

Here's an example of a single-line comment in C:
int main() {
    // This is a single-line comment
    printf("Hello, World!");
    return 0;
}