Any informative text that a programmer doesn’t want to be executed might be added as a comment. Either to make a piece of code more understandable or to explain the code. Additionally, it can be used to stop alternative code from running when debugging is complete.
You can use one or more lines for your comments.
Single line comment
- Beginning with two forward slashes (//), single-line comments.
- Any content on the same line that follows the slashes / will be disregarded (will not be executed).
#include <stdio.h>
int main()
{
//This is a single line comment
printf("Hello World!");
return 0;
}
multi-line comments
- A comment with multiple lines begins with /* and finishes with */.
- The compiler will disregard any data between /* and */.
#include <stdio.h>
int main()
{
/* This is a
multi-line
comment */
printf("Hello World!");
return 0;
}