Home Show/Hide Menu
C Tutorials
➜ C Language
  - Features of C
  - First C Program
  - Compilation in C
  - C Character Set
  - Tokens
  - Keywords
  - Identifiers
  - Constants
  - Operators
  - Data Types
  - Variables
  - Type Casting
  - Comments
  - Input/Output
  - Escape Sequence
  - Programming Errors
➜ Control Statements
  - if Statement
  - if-else Statement
  - Nested if-else
  - else-if
  - switch Statement
  - Loop
  - while loop
  - do while loop
  - for loop
  - break
  - continue & goto
  - Nested Loop
  - Infinite Loop
➜ Functions
  - What is function
  - Call by Value & Reference
  - Recursive function
  - Storage Classes
➜ Array
  - 1-D Array
  - 2-D Array
  - Return an Array
  - Array to Function
➜ C Pointers
  - Pointers
  - Pointer to Pointer
  - Pointer Arithmetic
  - Dangling Pointers
  - sizeof() operator
  - const Pointer
  - void pointer
  - Dereference Pointer
  - Null Pointer
  - Function Pointer
  - Function pointer as argument
➜ Memory Management
  - Memory Layout of C
  - Dynamic memory
  - calloc()
  - malloc()
  - realloc()
  - free()
➜ Strings
  - gets() & puts()
  - String Functions
  - strlen()
  - strcpy()
  - strcat()
  - strcmp()
  - strrev()
  - strlwr()
  - strupr()
  - strstr()
➜ C Math
  - Math Functions
➜ Enum, Structure & Union
  - Enum
  - Structure
  - typedef
  - Array of Structures
  - Nested Structure
  - Structure Padding
  - Union
➜ File Handling
  - fprintf() fscanf()
  - fputc() fgetc()
  - fputs() fgets()
  - fseek()
  - EOF and feof()
  - fsetpos()
  - tmpfile()
  - rewind()
  - ftell()
  - lseek()
➜ Preprocessor
  - Preprocessor
  - Macros
  - #include
  - #define
  - #undef
  - #ifdef
  - #ifndef
  - #if
  - #else
  - #error
  - #pragma
➜ Command Line
  - Arguments

Comments in C Language

A well-documention of program makes it more readable and error finding become easier. Comments in C language are used to provide information about lines of code. Comments are totally ignored by compilers. The Compiler does not generate executable code for these comments.


Comments in the C language can be classified into the following three types:
  • Single line comment (// Comments)
  • Multiline comment (/* Comments */)
  • Document Comment (/** Comments */)


1. Single line Comment (// _ _ _ ) - Most of the time single-line comments are used at the end of the line or before the line. The Compiler ignores everything from // to the end of the line.


#include<stdio.h>
void main()
{
   printf("Hello World!\n");  // display "Hello World!"
}

2. Multiline Comment ( /* _ _ _ */ ) - It is used to denote multi-line comment. It can apply comment to more than a single line. The compiler ignores everything from /* to */.
#include<stdio.h>
void main()
{
   printf("Hello World!\n");
   /* This is a multiline comment.
      These line will be ignored by compilers.*/
}

3. Document Comments ( /**_ _ _ */ ) - These C comments are used for Documentation purposes. The statements placed inside these special characters are ignored by the compiler while compiling.
//Addition of two number
/**
  * This Program Multiply two numbers.
  * author: Mr. Gourav
  * company: Know Program
  */
#include<stdio.h>
void main()
{
  int a = 8, b = 15, c;
  c = a*b;
  printf("Multiplication = %d\n", c);
}




ADVERTISEMENT