Popular Google Pages:
◕ Bengali Story writing competition. More..
◕ This article is regarding Integer Type in C++.
Last updated on: 13th November 2016.
Choose your Language: English Bengali
◕ Integers are numbers with no fractional part, such as 0, 1, 2, 55, -555 etc. There are lots of Integers; we can say infinite numbers or Integers are there. So no finite amount of computer memory can represent all possible Integers. Hence to holddifferent Integers, various C++ Integer Types are there.
C++’s basic Integer Types are char, short, int, long and long long. Each of them use different amount of memory to hold an Integer.
We can arrange them in order of increasing memory they used as:
char < short < int < long < long long
◕ Each of the above Integer Types can be Signed Type & Unsigned Type
Signed Types can represent both positive and negative values. Such as : +2, -2, +3, -3 etc.
Unsigned Types can’t represent negative values. They will be always like +2, +3 etc.
char Type has some special properties as it is most often used to represent characters ( like A, b, C etc. ) instead of numbers.
◕ All computer designs are not same. Different Computer has different design. Hence it would not be convenient to fix a particular amount of memory or width for each Integer Type. Still, C++ offers a flexible standard of memory with some guaranteed minimum sizes. Such as:
- A short Integer has at least 16 Bits of memory.
- An int Integer has at least as big as short.
- A long Integer has at least 32 Bits of memory or at least as big as int.
- A long long Integer has at least 64 Bits of memory or at least as big as long.
Top of the page