Abstract Data Types

Previously we’ve dealt with primitive datatypes  in C. 

Examples of some primitive data types are shown below:

Data TypeExample
integer int a=5;
Floating point numbersfloat a=5.1;
Characterchar input =’q’;

In this case we see that only one item of data is stored per variable declared.

Abstract Data Types  (ADTs)  store collections of data  and are accompanied by functions which perform operations on the data.

They are created for use by programmers who in turn manipulate the data collection by use of the provided functions. The programmer using the ADT is never expected to directly manipulate the collection of data.

ADTs are used to model collections of data in real world scenarios.

An ADT consists of  :

State- The container of items itself, information about the container of items e.g the size, a reference to the first item in the  list etc

Behaviour – The operations that can be performed on the collection of data. Usually adding and/or, updating, and/or removing items.

The array is the considered to be a basic abstract data type that was formalized to use indexing during the development of high level languages. supporting programs were built to allow for the creation and management of data access to arrays.

If you’ve previously created c structures and managed their use through functions then you’ve created a specialized ADT. For example, our book catalog is an ADT.

A seemingly unlikely ADT example: The array

Even though assignment and retrieval of data in array seems trivial and is supported by basic syntax as with other primitive data types; this was not the case during the early development of programming languages.

High level programming languages were modified so that arrays could use the basic syntax of variable declaration, initialization, assignment and access because of their expected widespread use.

© 2018Vedesh Kungebeharry. All rights reserved. Last Updated 17/9/2020.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s