1.

We know that the value of pi = 3.14157, a constant (literal). What is a. constant? Explain it.

Answer»

A constant or a literal is a data item its value doe not change during execution. 

1. Integer literals: 

Whole numbers without fractional parts are known as integer literals, its value does not change during execution. 

There are 3 types decimal, octal and hexadecimal. 

Eg. For decimal “100, 150, etc 

  • For octal 0100, 0240, etc 
  • For hexadecimal 0 × 100, 0x1 A, etc 

2. Float literals: 

A number with fractional parts and its value does not change during execution is called floating point literals. 

eg: 3.14157,79.78, etc 

3. Character literal: 

A valid C++ character enclosed in single



Discussion

No Comment Found

Related InterviewSolutions