{"id":2313,"date":"2024-11-06T10:44:56","date_gmt":"2024-11-06T10:44:56","guid":{"rendered":"https:\/\/itnotes.apjsoftwares.in\/?p=2313"},"modified":"2024-11-06T10:44:56","modified_gmt":"2024-11-06T10:44:56","slug":"c-comments","status":"publish","type":"post","link":"https:\/\/itnotes.apjsoftwares.in\/index.php\/2024\/11\/06\/c-comments\/","title":{"rendered":"C Comments"},"content":{"rendered":"\n<p>The&nbsp;<strong>comments in C<\/strong>&nbsp;are human-readable explanations or notes in the source code of a C program. &nbsp;A comment makes the program easier to read and understand. These are the statements that are not executed by the compiler or an interpreter.<\/p>\n\n\n\n<p>It is considered to be a good practice to document our code using comments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>When and Why to use Comments in C programming?<\/strong><\/h2>\n\n\n\n<ol>\n<li>A person reading a large code will be bemused if comments are not provided about details of the program.<\/li>\n\n\n\n<li>C Comments are a way to make a code more readable by providing more descriptions.<\/li>\n\n\n\n<li>C Comments can include a description of an algorithm to make code understandable.<\/li>\n\n\n\n<li>C Comments can be used to prevent the execution of some parts of the code.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Types of comments in C<\/h2>\n\n\n\n<p>In C there are two types of comments in C language:<\/p>\n\n\n\n<ul>\n<li><strong>Single-line comment<\/strong><\/li>\n\n\n\n<li><strong>Multi-line comment<\/strong><\/li>\n<\/ul>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/media.geeksforgeeks.org\/wp-content\/cdn-uploads\/20191113114930\/Comments.png\" alt=\"comments in c\"><\/p>\n\n\n\n<p>Types of Comments in C<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Single-line Comment in C<\/strong><\/h2>\n\n\n\n<p>A single-line comment in C starts with (&nbsp;<strong>\/\/&nbsp;<\/strong>) double forward slash. It extends till the end of the line and we don\u2019t need to specify its end.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Syntax of Single Line C Comment<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ This is a single line comment<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. Multi-line Comment in C<\/strong><\/h2>\n\n\n\n<p>The Multi-line comment in C starts with a forward slash and asterisk (&nbsp;<strong>\/*<\/strong>&nbsp;) and ends with an asterisk and forward slash (&nbsp;<strong>*\/<\/strong>&nbsp;). Any text between&nbsp;<strong>\/*<\/strong>&nbsp;and&nbsp;<strong>*\/<\/strong>&nbsp;is treated as a comment and is ignored by the compiler.<\/p>\n\n\n\n<p>It can apply comments to multiple lines in the program.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Syntax of Multi-Line C Comment<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\/*Comment starts\n    continues\n    continues\n    .\n    .\n    .\nComment ends*\/<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The&nbsp;comments in C&nbsp;are human-readable explanations or notes in the source code of a C program&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[],"_links":{"self":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/2313"}],"collection":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/comments?post=2313"}],"version-history":[{"count":1,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/2313\/revisions"}],"predecessor-version":[{"id":2314,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/posts\/2313\/revisions\/2314"}],"wp:attachment":[{"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/media?parent=2313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/categories?post=2313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itnotes.apjsoftwares.in\/index.php\/wp-json\/wp\/v2\/tags?post=2313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}