C Program Comments| C Programming Comments
C Comments can be single lined or multi lined.
Comments make the program more readable and explains the program in a better way.
Single lined comments start with two slashes (//) , and the compiler ignores those lines i.e. will not be executed by the compiler.
Example of single lined comment:
#include <stdio.h>
int main()
{
//This is a comment.
printf("Hello World!");
return 0;
}
OUTPUT of above program:
Hello World!
Multi lined comment starts with /* and ends with */
so as soon as the compiler comes across /* it starts ignoring those lines from compiling and as soon it comes across */ compiler understands end of comment.
Example of multi lined comments:
int main()
{
/*This is a comment.*/
printf("Hello World!");
return 0;
}
OUTPUT:
Hello World!