codizzmafia banner

Codizzmafia | Programming related Articles and News.

comments in c,comments in c language,comments in c programming,types of comments in c language,what are comments in c,What is code comment?,How do you write a comment in programming?,what is single line comment?


To learn very easy and deep understanding programming you should follow Q & A way,which is covered in this article.by using this way you get real time examples and also cover basic syntax and meaning of particular topic.you also get something new which is newer seen before in your programming journey.


comments in c language


Comments are a way of interesting and reminders into code without affecting its behavior. Since comments are only read by other humans, you can put anything you wish to in a comment, but it is better to be informative than humorous.

In c language compiler ignores comments,so you can write short description about your code portion and you can also write like which code portion is used particular project module and so on..

That’s why comment perform important role in c language and it is very useful for programmers.

types of comments in c language

What is a single line comment?

There mainly two types of comments in the c language as following:

1) single line comment
2) multiple line comment

Single line comment :

It is also called as double slash comment,it mainly use for only one line comment in the program,For example if your project based on school management system and you create a code of it,then you can labeled a comment with different module of your code,like for office code you can labeled it with office code and for classroom and staffroom you can labeled it classroom code and staffroom code respectively.

Now you have an questions that how can write single line comment in c language.so , it is easy to write single line comment in your c program.

SYNTAX:


You just write // at the starting of words.

Example :


// classroom code

Multiple line comment:

It is also called as slash asterisk comment,because syntax is form of asterisk and slash,it is used when you want more than one line comment in program.generally it is used when programmer want to write long description about specific module of the code.For Example,some programmer writes short description about their project in the top of the coding file.

Let’s check the syntax of multiple line comment in c language.

SYNTAX:


You can generate multiple line comment by writing /* at the starting of description and */ at the ending of the description.

Example:


For example some programmer create a project on online shopping in c.

/*This project based on online mobile shopping,we include multiple season offer page and online billing system in this project and in the billing system we include bill storing,which is stored in text file. by use of some file handling concepts.*/



How do you write a comment in programming?

For write single line comment we use (//) double slash and for multiple line comment we use (/*….*/)slash and asterisk.

Single line comment in programming

#include<stdio.h>
#include<conio.h>

Void main()
{
 //variable declaration;
 Int a=1,b=2,sum;
 //calculation
 Sum=a+b;
 //result in console
 Printf(“the output is: %d”,sum);
 getch();

}

Multiple line comment in the programming

/*this program calculate two integer values and final output stored in to integer variable and display it in the console screen by using printf function.*/

#include<stdio.h>
#include<conio.h>

Void main()
{
 //variable declaration;
 Int a=1,b=2,sum;
 //calculation
 Sum=a+b;
 //result in console
 Printf(“the output is: %d”,sum);
 getch();

}



What is code comment?

Code commenting is programming method or practice of writing short notes in your code which is called comment.which explain every different different program modules in your code.
Some professional programmer use this kind of method in their programming.you should make a habit of this kind of method in your programming courier.

what are comments in  c language

must watch this tutorial 





Thank you.

for any question please comment in the below section…..

Post a Comment

Previous Post Next Post

native_banner