Data Types
In programming, there are several kinds of types to describe variables. In most interpreted languages, variables can take any type. In compiled languages, programs have to specify what type of data is being stored so that the computer can handle it.
Contents
Primitive Types
Primitive types are types that can be calculated directly by a CPU. Every other data type is merely a collection or abstraction of primitive types.
Integers
The most common types of variables are integers. If an integer is signed (this is the default in most languages), they can store both positive and negative numbers. If an integer is unsigned, they can store only positive numbers and zero. For more information, see the wikipedia page on it.
Floating-point Numbers
Floating-point numbers hold rational numbers, or numbers that contain a decimal point. They're called floating-point numbers because the decimal point "floats" to a different decimal position. For example, 10 and 100 can be represented as 1 x 101 and 1 x 102. Both of these have the same decimal value, however, the decimal point is in a different place.
Booleans
Boolean variables hold one of two values: true or false. In most languages, integers and floating-point numbers can be converted to booleans directly - values of 0 are considered to be false, and any other value is considered to be true.
Arrays
Arrays contain a set of variables of the same type.
Strings
Strings contain a textual string of characters. In most languages, a single character in the string is represented by an integer.
In most languages, strings are a class. However, in other languages, they are considered to be a separate type of their own.
Object Types
Data Structures
Data structures contain multiple variables which are bundled together. For example, you can create the data structure coord, which stores two integers for x and y.
Classes
Classes are data structures which also contain functions. Some languages allow classes that contain functions without variables.
Pointers and References
These kinds of types are very rarely implemented into interpreted languages. Pointers and references store the specific memory location of an object. These types are often used to refer certain variables to a function so that they can be modified directly.