Data Types

All programs are composed of two items: Data and Operations on that Data. Because, at their heart, computers are simple devices, they can only represent very simple pieces of information. All complex information must be built up from these basic Data Types. The data types can roughly be described as: numbers, booleans, characters, arrays, and structures. Some languages like ActionScript replace characters with "strings". Object oriented languages, such as C++ and Java replace "structures" with "objects".

Data Types

All programs involve storing and manipulating data.

Luckily (???) the computer only knows about a few types of data. These include, numbers, true/false values, characters (a,b,c,1,2,3,etc), lists of data, and complex "Structures" of data, which build up new data types by combining the other data types.

Here is a brief summary of the available data types:

C, Matlab

  • Numbers, (e.g., 7, 3.14).

  • Booleans (true or false)

  • Characters ('a', 'b', ... 'z', '1', '2', ... '9', '!', '^', etc)

  • Arrays (a list of data (all of the Same Data Type!))

  • Structures (a collection of named data referring to a single entity)

ActionScript

  • Numbers, (e.g., 7, 3.14)

  • Booleans (true or false)

  • Strings (a list of characters ("hello", "jim"))

  • Arrays (a list of data)

  • Objects (a collection of named data referring to a single entity (also contains functions on that data))

All computer programs, from brain scanners to video games to music players, use these same basic data types to represent all possible information.

It should be noted that computer programs often approximate information, that is they represent information inaccurately or perhaps it would be better to say imprecisely. An example of this is the value of pi. For most of us, pi is roughly 3.1415 and this value works just fine. For engineers pi is 3.14159265358979323846. For mathematicians and scientists, pi might be 3.1415926535897932384626433832795029. Thus it can be said that a computer deals in abstractions and approximations.

Below are some more examples and specifics for the various data types.


Back to Topics List