Modern programming languages provide facilities for separating public and private aspects of interfaces. While C does not explicitly provide facilities, there is a way of organizing code that yields this separation. Data types defined in this way are called abstract data types, or ADTs for short.
The idea of an ADT becomes apparent when one considers built-in types, such as int. An int variable, up to certain technicalities, holds integer values; it can be manipulated using arithmetic operations. A knowledge of how an int value is represented in memory, or how arithmetic on ints is implemented, is unnecessary to use int data. Indeed, two computer architectures may implement int operations in different ways. Now suppose, for example, that one might want to manipulate matrices, coordinates, or complex numbers, none of which are part of C. We must define these types and their corresponding operations. An ADT is a programmatic method of defining new data types in a modular and elegant fashion.
KeywordsUnit Test Tail Index Abstract Data Type FIFO Queue Type Declaration
Unable to display preview. Download preview PDF.