Data Types

The concept of Data Types is Extremely Important and often given just a cursory glance, especially by newbies.

 

However, data types are at the core of how the compiler works out how to determine a program’s storage requirements.

 

The more complex data types (covered later) similarly define storage requirements for the object being specified.

 

At this point it is important to know that all objects must have a data type, which ultimately define their storage requirement.

 

Also, expressions and functions are preceded with a data type, to inform the compiler…

 

Fundamental Data Types:

char 

short

int

long

float

double

bool

void

Single character 

Short integer

Integer whole number

Long integer

Floating point number correct to 6 decimal places

Floating point number correct to 10 decimal places

Boolean value of TRUE (1) or FALSE (0)

No value returned

D 

65535

4294967295

4294967295

17.031963

12.0270140242

True or 1, False or 0

--

1 Byte 

2 Bytes

4 Bytes

4 Bytes

4 Bytes

8 Bytes

1 Byte

--

0-255 

0-65535

4294967295

4294967295

+/-3.4e+/-38

+/-1.7e+/-308

true or false

--

 

The progression of the data types evolves from the primitives above, to:

 

  • compund data types
    • arrays
    • multi-dimensional
    • strings
    • vectors
    • structures
    • unions
  • abstract data types
    • class -> objects

 

I hope to show the transition from the basic to the complex, in the hope that others will have a similar ‘eureka’ moment as I had.

 

I think the whole ethos behind this, is learning the concepts in the correct sequence -- build upon foundations… ¬†which means getting the concepts ordered properly, and explaining them properly. no bs = cut the crap.

Leave a Reply