Comments in C

Comments are to provide a piece of information about the code. A comment can help the other programmers to understand the program flow. In C Programming Language, there are two types of commenting options: Single Line and Multi-line.

C Single Line Comment Example

The Single Line comments start with two forward slashes(//). In this program, we are displaying Hello World as the C Programming output. Here, we used a single line.

#include<stdio.h>

int main()
{
    // Printing Hello World Message as Output
    printf(" Hello World! \n");

    return 0;
}
 Hello World! 

Multi-Line Comments Example

The Multi-Line Comments placed in between /*……… */. Use this Slash and asterisk to write a multi-line.

#include<stdio.h>

int main()
{
    /*
     Print
     Message
     as an Output
     */
    printf(" Welcome to Tutorial Gateway \n");

    return 0;
}
C Comments example 2

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.