Which character is used to represent a comment in C code?
A. #
B. //
C. /*
D. ;
Answer: Option B
Solution(By Examveda Team)
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;
}
Related Questions on C Fundamentals
What is the primary purpose of a function prototype in C?
A. Declare a variable
B. Declare a function
C. Define a function
D. Assign a value
What is the correct syntax for declaring a variable in C?
A. int variable_name;
B. variable_name = 5;
C. variable_name int;
D. int = variable_name;
Join The Discussion