Comments and Introduction to Compiler

  • Comment:In Programming,Comments are the statement which is used for explanation or annotation in the source code of a computer program.This statement are ignored by compiler and interpreter.The purpose of using Comment in program is explaining the code in normal language like English,it is also beneficial for programmers because after a certain time if programmer look at his code then it would be difficult to understand without comment hence,We use comment.
  • Types of Comment:

1.Single line comment:This is a Single line comment it is used to comment only one statement.//(2 forward slash) is used for single line comment.

Eg:

int b;//declaring variable

In above eg,We declared variable b and put comment by using // .So all the statement on the same line after // will be ignored.

2.multi-line comment:It is used when we want to comment multiple statement./* */(forward slash * * forward slash) is used for multi-line comment.In multi-line all the statement inside the /* */ will be ignored.

/*

Author:Pankaj Jaiswal

Date:12/1/2021

*/

int a=4;

int b=5;

  • Compiler:In Computing,Compiler is a program which is used to convert high level language program(C,C++,Java etc) in low language(Machine code)program.We convert the program in machine language because computer does not understand high level language(C,C++,Java) program.Machine language is also called as binary language(1 and 0 language).