C – Comments

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;
}
Shubhajna Rai
Shubhajna Rai

A Civil Engineering Graduate interested to share valuable information with the aspirants.

Leave a Reply

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

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in