Search your topic here

PPL: Primitive Data Type


Primitive data types are data types which are not defined with support of other data types.

Some of the primitive data types are:
1. Numeric types
2. Boolean types
3. Character types
  1. Numeric Types: These are the numbers.
    1. Integer: A data type that represents some range of mathematical integers. Different programming languages supports different size of integers.                                                        For example,  
      • Java includes four signed integer sizes: byte, short, int, and long.
      • C++ and C#, include unsigned integer types (value without sign).
      • int age = 20;
    2. Floating-Point: Floating-point data types model real numbers. Most languages include two floating-point types, often called float and double.
        • Float type is the standard size, usually being stored in four bytes of memory.
        • Double type is provided for situations where larger fractional parts and/or a larger range of exponents is needed.
        The collection of values that can be represented by a floating-point type is defined in terms of precision and range.
        • Precision is the accuracy of the fractional part of a value, measured as the number of bits.
        • Range is a combination of the range of fractions and, more important, the range of exponents.
    3. Complex: Complex values are represented as ordered pairs of floating-point values. It contains a imaginary number. It includes operations for arithmetic on complex values.
      For example, in Python, (8 + 2j), contains j as imaginary number.
    4. Decimal: Decimal data types store a fixed number of decimal digits. For example, the number 0.1.

  2. Boolean Types: It has only two elements, true and false. Boolean types are often used to represent switches or flags in programs.

  3. Character Types:  It stores a single character and requires a single byte of memory in almost all compilers.


Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.