Free programming examples and instructions

Add Comments C

Code for how to add comments in c programming

by Athil

Posted on 22 Jan 2017 Category: C Views: 1084

Edited on 26 Jun 2017


Comments are explanatory remarks made within the program. They help to mention what the complete program is about. These words are not for execution.

Basically comments are used to write instructions about the code what the programmer done in the code. This help the programmer in future modification of the program. A good programmer must comment all about the coding. If a programmer works for a company he has to write his name and contact info on the program.

We can add comments by two ways

1 Single Line Comments

                By Giving a double slash on the beginning of the words (//).


  //This program is about to find the factorial of a number.

2 Multiline Comments

                By giving /* and */ symbols at the beginning and end of the statements.


/* This program is to about add two numbers and get the result as output.

 This program is done by Mr. John Smith  BCA Student of IGNOU University during the year 2006. */


A Program

#include <stdio.h>
void main()
                /*Program to find average marks*/
                float m1,m2,avg;
                printf(“Enter the marks”);
                avg = (m1+m2)/2;
                printf(“\nThe average mark is%f “,avg);



Leave a Comment: