Comments in C

Comments in C

Hello Everyone, Welcome back to Think & Free. Here another episode of Express Learning Programming with the GNU C Programming Language Programming Series. Today I’m going to show you What and, How to Use Comments in C.

What is Comments ?

In Every programming language, Comments used to take notes about codes. It helps more to make the program easier for developers. Another thing is
comments are used for sometimes, temporarily deactivate some code lines.

In Compiler Programming Languages, Compiler will ignore Comments at the compilation process. That means the compiler didn’t include comments for compiled files. The Comments only allowed the Developer can, see, create & edit. In Interpreted Programming languages, The interpreter will be ignored interpret Commented code lines.

Let’s see how can we use it.

Comments in C

Comments and their Syntax will difference between language to language. Basically in C Programming Language, we can see two types of comments. Let’s look at what are they.

  • Multi-line or Block Comments
  • Single-line Comments

These are the two types of Comments we can use in the GNU C Programming Language. The multi-line comments will allows you to create a block of comment or something like a paragraph or something like that. All these comments can be used in anywhere in your program, comments are not location specified.

C Multi-line Comment

In this type of comments will allows to set multi-line comments in C, it’s like you can use some comments like paragraphs. let’s see how to use this type comments in C.

Multi-line comments will start with /* and it ends with “*/“, in every content in these “/* */” block will ignore compiler in the compilation process. it’s only allowed to the developer to take note that codes.

C Single-line Comment

Here is another type of Comment syntax we can use in the C Programming language. let’s see how to use it. If in any line we can start this type of comments using “//“.

Let’s look at the example down below. You can get a some idea on it.

/*
    C comments Example by Think & Free
    This is a Multiline comment in C
    Here is the third line.
*/
#include <stdio.h>
int main()
{
    // Print 'Hello, World' String on Console window
    printf("Hello, World\n");
    return 0;
}

Look at the code, now you can compile and run this code, see the result (If you don’t have an idea of how to compile and run C code. check out our previous lesson). It will only provide, output for “printf("Hello, World\n");“. I think that’s enough for, Get some idea about “Comments” in C. See you back soon with another episode of this Express Learning Programming win GNU GCC Programming Language. “Practice yourself” it’s the only way to learn something new.

Leave a Reply

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