Home » Programming » 04 - Data Types and Storage Management
4

Elementary Data Types

Data types fall under several categories and can be divided into the elementary data type, the structured data type, or the abstract data type. The elementary data types are the most basic of all.

What are the different kinds of data types that are available for use in programming? Data types fall under several categories and can be divided into the elementary data type, the structured data type, or the abstract data type. The elementary data types are the most basic of all. The structured data types are a composition of the elementary data types and a little more. The abstract data types basically have traits from both the elementary and the structured data types.

Elementary Data Types

Elementary data types are the basic data types. Basic numeric data like integers and floating point real numbers are considered to be elementary data types. The integer data type that you have been using is one of the many elementary data types in Visual Basic. Boolean or Logical data types are also of the elementary category. A Boolean value is either True or False, 1 or 0, respectively. Characters are elementary data types too. A character is a letter, a digit, or a special symbol used to represent a data element. Characters are usually strung together to form names (see the previous chapter on more details about names).

Enumerations are considered to be an elementary data type. An enumeration is a set of values which can be represented by the set of positive integers. For example, you can make the type “BoxColor” which could take on the values of blue, green, red, orange, or yellow. The colors represent the integers from one to five. The programmer is the one who defines the values and the associated integers for it. A subrange is an elementary data type that has programmer specified ranges too. These subranges are restricted within a parent range. A subrange results in better type checking.

Pointers are elementary data types that contain a location of another data object or the null pointer. There are two fundamental pointer operations. Assignment sets the pointer variable to the address of some object. Dereferencing allows the pointer to be followed to the data object to which it points.

You can try using these elementary data types and putting them to use. Aside from the integer data type that you have been using, make a Boolean variable by typing in Dim YourVariable As Boolean.