Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C Programming » Tutorial » Comments in C

Comments in C language are used to provide information about the code. It is widely used for documenting the code and mostly above the code. A comment starts with a slash asterisk /* and ends with a asterisk slash */ and can be anywhere in your program. Comments can span several lines within your C program.

Syntax of Comment

/* comment goes here */

Example of Comments

/* include the header file */
#include<stdio.h>

/* this function calculates sum of two integer values */
int sum(int, int);

int main()
{
}

int sum(int a, int b)
{
	return a+b;
}

Multiline Comment

/*
 * Author: CppBuzz.com
 * Purpose: Function to calulate sum of two int number
 * Language:  C
 * Date : 05/05/2018
 */