C Comments

In C language comments are used to explain the code and make it more readable. Comments can also be used to prevent execution, when testing alternative code. There are two types of Comments :

1. Single Line Comment :

A single-line comment begins with double forward slash (  ). Any text after   will be ignored by the C compiler. For example :
#include <stdio.h>

int main() {
  // instruction begins from here 
  printf("Hello world.!!\n");
  return 0;
  // instruction ends from here
}

2. Multiline comment :

A multi-line comment begins with forward slash and asterisk ( /* ), and end with the reverse asterisk and forward slash ( */ ). Any text between /* and */ will be ignored by C compiler. For Example :
/*
 This is smaple code for test
 File name : test.c
*/

#include  <stdio.h>

int main() {
   /*
   instruction begins from here 
   */

  printf("Hello world.!!\n");
  return 0;
  /* instruction ends from here */
}

Next Topic :