Comments In C Programming language

 Comments in C language 

Understanding Comments in C language: -

In this blog post, I would like to discuss with you the term "Comment".

Comments: -

In C programming, comments are generally used as the explanation in a source code( or code).

The comments written in the source code are non-executable, So the compiler does not execute the comments written.

There are two types of comments in C. They are: -

  1. Single-line comment (or) end-of-line comment: -
  2. Multi-line comment (or) traditional comment: - 

Single-line comment (or) end-of-line comment: -

As the name suggests the single line comment is used for single-line statements 

It starts with  // and the statement is written till the end of that line.

Check out this code to know more about single-line comments:

Program: -

#include <stdio.h>

void main() {

    printf("Hello C!");

    print("I am learning C");

    //print("sairam pashikanti");

}

Output: - 

Hello C!

I am learning C

Sairam pashikanti C programming language
Example of single-line comment or end-of-line comment


Multi-line comment (or) traditional comment: -

As the name suggests the multi-line comment is used for multi-line statements 

It starts with  /* and the statement is written then the line ends with */.

Check out this code to know more about multi-line comments:

Program: -

#include <stdio.h>

void main() {

    printf("Hello C!");

    /*print("I am learning C");

    print("sairam pashikanti");*/

}

Output: - 

Hello C!

Sairam pashikanti C programming language
Example of multi-line comment or traditional comment

"Thank you!"




Comments

Popular posts from this blog

"Introduction to C programming Language"

Program to find Sum and Average of three Numbers