MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

C++ language

Constant
Previous Home Next

constant are like variable  but the difference between constant and variable is that constant value fixed it can't change in whole program but variable value can change during program.

Enumeration Constant

An enumeration data type, data type represents a set of identifiers. Each identifier in this set is an enumeration constant.

The value of the enumeration constant is determined as:
  •  In enumeration constant assigned to the explicit value for set of identifier.
  •  If no explicit value is assigned, the leftmost constant in the set of receives the value zero (0).
  •  If in the set of integer identifiers with no explicitly assigned values that is one greater than the value represented by the previous identifier.

When declare const its must have initializes means in left hand contain the name of constant and in right hand side have the value of that constant except those referencing externally defined constants.

If constant is an integer then const object can appear in a constant expression and it is initialized to a constant.

The following example:
const int number = 200;
int ary[number];  /* allowed in C++*/.

 

If a global const object have no any explicit storage class then it consider as static const by default.

const int number = 12;
static const int number1 = 120; 
extern const int number2 = 121; 

Because its linkage is assumed to be internal, a const object can be more easily defined in header files in C++ than in C.

Previous Home Next