Why are comments used in C?

Why are comments used in C?

a) To explain code
b) To make code faster
c) To run code
d) To compile code

Answer:

a) To explain code

Explanation:

Comments in C are used to provide explanations or notes within the source code. They are not executed by the compiler, meaning they do not affect the program’s performance or functionality. Comments are essential for making the code more understandable to other developers or to yourself when revisiting the code after some time.

There are two types of comments in C: single-line comments (starting with //) and multi-line comments (enclosed between /* and */). Proper use of comments helps in maintaining the code, especially in complex programs where understanding the purpose of specific code sections is crucial.

Reference links:

https://www.rameshfadatare.com/learn-c-programming/

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top