Primitive data types

Discussion in 'Mixed Languages' started by Bornung1, Jun 11, 2011.

  1. Bornung1

    Bornung1 MDL Member

    Oct 9, 2010
    148
    38
    10
    Is it true that Primitive data types contains so many undergroups, and what is really the difference? :aglerks:


    NUMBERS that contain 2 undergroups called INTEGERS AND REAL NUMBERS

    INTEGERS contains 4 undergroups called / byte / short / int / long

    REAL NUMBERS contain 2 undergroups called / double / float


    CHARACTERS that contain 2 undergroups called / char / string


    LOGICAL that contain 1 undergroup called / boolean
     
  2. tuning_xx

    tuning_xx MDL Novice

    Dec 15, 2009
    1
    0
    0
    The main difference i think is the memory size need for each one, for instance, int spend more memory than a byte.
    For small or embedded systems is a big difference. :)
     
  3. evlad

    evlad MDL Member

    May 23, 2011
    225
    175
    10

    in unsigned byte you can store digit between 0~255 or in hex 0x0~0xFF
    byte contains bit, bit can be 0 or 1 and represent power of base 2
    255 = 2^0 + 2^1 + ... + 2^7
    binary 11111111 = decimal 255 = hex FF

    if byte is signed then you can store number between -127 ~ +127
    binary (1)1111111 where (1) represent sign for positive or negative number

    byte reserve one byte in ram memory.

    same story is for word data type ... word reserve 2 byte in ram memory, it can store digits 0~65635

    char is same like unsigned byte (polymorphism)
    and string is array of char terminated with null character.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...