UMBC CMSC 201 Fall '05
CSEE | 201 | 201 F'05 | lectures | news | help

Data Types

Data structures form a hierarchy

Data structures form a hierarchy within a program. The atomic data types, such as int, char, double occupy the lowest level of the hierarchy.

To represent more complex information, you combine these atomic types to form larger structures. These structures can then be assembled into even larger ones in an open-ended process.

You build each new level in the hierarchy by using one of the three primitives for type construction: arrays, structs and pointers. Given an existing type, you can define an array of that type, include it as a field of a record, or declare a pointer to it. These three facilities constitute the mortar of the data hierarchy and allow you to build arbitrarily complex structures.

As you learn more about programming, you'll discover that particular data structures can be extremely useful and are worth studying in their own right.

Example: strings

A good example is the string.

A string in C is represented internally as an array of characters, which is in turn represented as a pointer to the first address in the array.

But a string also has an abstract behavior that transcends its representation.

So regardless of its implementation, a string is a group of characters that are thought of as a single object.

The operations on strings include :

We say that a string is an abstract data type.

CSEE | 201 | 201 F'05 | lectures | news | help

Sunday, 20-Nov-2005 18:07:37 EST