English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C language comments are used to provide information about the code line. They are widely used for recording code. There are two types of comments in C language.
Single-line comments
Multi-line Comments
Single-line comments use double backslashes//Representation. Let's look at an example of a single-line comment in C language.
#include<stdio.h> int main() { //Print Information printf("Hello C"); return 0; }
Output:
Hello C
Even you can add comments after statements. For example:
printf("Hello C");//Print Information
Multi-line comments use backslash asterisks/ * ... * /Representation. It can occupy multiple lines of code, but cannot be nested. Syntax:
/* To Comment Code */
Let's see an example of a multi-line comment in C language.
#include<stdio.h> int main() { /*Print Information Multi-line Comments*/ printf("Hello C"); return 0; }
Output:
Hello C