K
Ketan
asked

Expert
Abhay Jajodia answered
To write multi-line comments in C, you use the /* ... */ syntax. Everything between these symbols is treated as a comment and will be ignored when the program runs.
Here's a simple example:
#include
int main() {
/* This is a multi-line
comment. You can write
as many lines as you need.
*/
printf("Hello World");
return 0;
}
Notice that this code contains the following multi-line comment:
/* This is a multi-line
comment. You can write
as many lines as you need.
*/Key Points:
Use
/* ... */for both single and multi-line comments.Comments are helpful for explaining code, making notes, or temporarily disabling code.
Anything within
/* ... */will be ignored by the compiler.
Hope this makes the concept clearer for you! Feel free to ask if you have any more questions or need further assistance. Happy coding!
C
This question was asked as part of the Learn C Programming course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer