Comments in C

Comments in C language are used to provide information about lines of code. It is widely used for documenting code. There are 2 types of comments in the C language.

  1. Single Line Comments
  2. Multi-Line Comments

Single Line Comments

Single line comments are represented by double slash \\. Let’s see an example of a single line comment in C.

[cc lang=”bash” escaped=”true” width=”auto” nowrap=”0″ theme=”blackboard” line_numbers=”off” ]
#include
int main(){
//printing information
printf(“Hello C”);
return 0;
}        [/cc]

Output:

Hello C

Even you can place the comment after the statement. For example:

[cc lang=”bash” escaped=”true” width=”auto” nowrap=”0″ theme=”blackboard” line_numbers=”off” ]
printf”Hello C”//printing information[/cc]

Multi Line Comments

Multi-Line comments are represented by slash asterisk \* … *\. It can occupy many lines of code, but it can’t be nested. Syntax:
/*code
to be commented
*/
Let’s see an example of a multi-Line comment in C.
[cc lang=”bash” escaped=”true” width=”auto” nowrap=”0″ theme=”blackboard” line_numbers=”off” ]#include
int main(){
/*printing information
Multi-Line Comment*/
printf(“Hello C”);
return 0;
} [/cc]

Output:

Hello C

Related Post

Create Firebase single Page Website Create firebase single page Website tutorial In this tutorial we are study how to create single page website by the use of firebase hosting its very ...
Navigation Tab Bar in IOS | Swift tutorial Navigation Tab Bar in IOS | Swift tutorial Different Customizing techniques for Navigation bar with storyboard and code 1) Custom NavigationTabBar b...
Create UITableView (Table View) By the use of stor... How to use UITableView in Above IOS 8 and Swift (UITableView) In this tutorial we are study how to use the TableView in Swift. One of the most common...
Introduction to Java Programming Language JAVA TUTORIALS Introduction to Java Programming Language What is JAVA Java is programming language that produces software for multiple platforms, w...
New Features XCode 12 – IDE Supported Configurations Xcode 12 beta includes SDKs for iOS 14 iPadOS 14 tvOS 14 watchOS 7 macOS 11 The Xcode 12 beta release supports o...
Data Type And Storage And Keywords To store data inside the computer we need to first identify the type of data elements we need in our program. There are several different types of dat...
Author

Write A Comment