November 2, 2026 · AKTU Notes

AKTU Data Structures Foundations: C Data Types, Data Organization and ADTs

targetsemester

AKTU Data Structures Foundations: C Data Types, Data Organization and ADTs

Before starting Data Structures, you should be able to use C variables, loops, functions, arrays and pointers. You should also know how a structure groups related values. The next step is to understand an Abstract Data Type (ADT): a description of data and its operations, without choosing how to store it. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/index.html?utm_source=openai))

These AKTU data structures basic terminology and ADT notes cover the Introduction topics identified in the supplied syllabus details. No branch, semester, course code or unit number has been supplied, so none is assumed here.

1. Basic Data Structures Terminology

A data structure is a way to arrange data so that a program can use it effectively. Its design affects how operations such as searching, insertion and deletion are carried out. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/dataStructure.html?utm_source=openai))

Key terms with a student-record example
Term Simple meaning Example
Data item One value being stored or processed A student’s marks: 82
Field or attribute A named part of a record Roll number, name or marks
Record A group of related fields One student’s roll number, name and marks
Entity The person or thing described by data A student
Key A field, or group of fields, used to identify or locate a record A unique college roll number

Records describe entities through named fields and their values. A field chosen as a unique identifier must distinguish one record from the others. ([ibm.com](https://www.ibm.com/docs/en/i/7.5.0?topic=relationships-levels-data&utm_source=openai))

2. Elementary Data Organization

Data can be studied at different levels. A common introductory model moves from small storage units to meaningful groups of data. ([files.eric.ed.gov](https://files.eric.ed.gov/fulltext/ED332671.pdf?utm_source=openai))

Bit → Byte → Field → Record → File
  • Bit: a binary digit, either 0 or 1.
  • Byte: a unit of storage. On common systems, it contains 8 bits.
  • Field: one named part, such as a student’s name.
  • Record: related fields describing one student.
  • File: in this record-based model, a collection of related records.

This is a teaching model, not a rule for every file format. Also, C does not require a byte to contain exactly 8 bits; CHAR_BIT gives its bit count. ([files.eric.ed.gov](https://files.eric.ed.gov/fulltext/ED332671.pdf?utm_source=openai))

Example: Organizing Student Data

Student file
├── Record 1: 101 | Asha  | 82
├── Record 2: 102 | Kabir | 76
└── Record 3: 103 | Meera | 91

Fields in each record:
Roll number | Name | Marks

An elementary item is treated as one unit for the task. A group item contains smaller items. For example, an address may be split into house number, city and PIN code. ([ibm.com](https://www.ibm.com/docs/en/i/7.5.0?topic=relationships-levels-data&utm_source=openai))

3. Built-in C Data Types

A C type tells the compiler what kind of value an object can hold. Start with integer types, floating-point types and void. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Primitive-Types.html?utm_source=openai))

Common C types needed before Data Structures
Type Main use Declaration
char Character codes and small integer values char grade = 'A';
int Whole numbers int count = 5;
float Floating-point values float average = 72.5f;
double Floating-point values with at least as much precision as float double mean = 72.5;
void No returned value in a function declaration void display(void);

Integer type specifiers include short, long, signed and unsigned. Examples are short int, long long int and unsigned int. ([gnu.org](https://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html?utm_source=openai))

Do Not Assume Fixed Type Sizes

sizeof(char) is always 1 C byte. However, int is not always 4 bytes, and pointers are not always 8 bytes. Use sizeof to check your implementation. ([open-std.org](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf))

#include <stdio.h>

int main(void)
{
    printf("int: %zu bytesn", sizeof(int));
    printf("double: %zu bytesn", sizeof(double));
    return 0;
}

Exam point: If a numerical question gives a type size, use that value. If it does not, state any size assumption clearly.

4. C Concepts Used to Build Data Structures

Arrays: Several Elements of One Type

A C array stores elements of one type in consecutive memory locations. Indexing starts at zero. For an array with three elements, valid indices are 0, 1 and 2. ([open-std.org](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf))

int marks[3] = {82, 76, 91};
/* marks[0] is 82; marks[2] is 91. */

Array indexing also relates to pointers: marks[i] means *(marks + i). However, an array and a pointer are not the same kind of object. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Pointers-and-Arrays.html?utm_source=openai))

Structures: Related Fields of Different Types

A struct groups named fields. Unlike array elements, its fields may have different types. This makes it useful for records. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Structures.html?utm_source=openai))

struct Student {
    int roll;
    char name[20];
    float marks;
};

struct Student s = {101, "Asha", 82.0f};

Here, s.roll, s.name and s.marks access the three fields. An array of struct Student can hold several student records. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Structures.html?utm_source=openai))

Pointers: Referring to Objects

A pointer can hold the address of an object. The & operator obtains an address, while * accesses the pointed-to object. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Pointers.html?utm_source=openai))

int marks = 82;
int *p = &marks;
*p = 90;  /* marks is now 90. */

Pointers help connect linked-list nodes. Each node can store a value and a pointer to the next node. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Structures.html?utm_source=openai))

struct Node {
    int value;
    struct Node *next;
};
head → [10 | next] → [20 | next] → NULL

Other Useful C Features

  • Functions: separate operations such as searching or insertion.
  • typedef: gives an existing type another name; it does not create an ADT by itself.
  • enum: defines named integer constants.
  • Dynamic allocation: malloc requests memory at run time; check for failure and use free when that memory is no longer needed.

These language features support implementations, but the chosen data representation and operation rules still need careful design. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/c-intro-and-ref.html?utm_source=openai))

5. What Is an Abstract Data Type?

An Abstract Data Type (ADT) defines a set of possible values and the operations allowed on them. It specifies their meaning without choosing a particular implementation. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/abstractDataType.html?utm_source=openai))

A useful way to remember it is:

ADT: What can the user do, and what must happen?
Implementation: How does the program make it happen?

Example: Stack ADT

A stack follows LIFO: Last In, First Out. The most recently added item is removed first. Its common operations are push, pop, peek or top, and isEmpty. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/stack.html))

A sample stack interface
Operation Defined behaviour
push(x) Add x at the top.
pop() Remove and return the top item.
peek() Return the top item without removing it.
isEmpty() Report whether the stack has no items.

Here, pop combines reading and removing the top item. Some interfaces define these as separate operations. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/abstractDataType.html?utm_source=openai))

Start:       []
push(10):    [10]
push(20):    [10, 20]  ← top
pop():       returns 20
After pop:   [10]

A complete specification must also state what happens when an operation cannot succeed. For example, removing from an empty stack needs a defined error result or a rule requiring the caller to check first.

6. ADT Versus Implementation

Separate behaviour from storage
Point ADT Implementation
Main concern Values, operations and their meaning Storage layout and algorithms
Stack example Last added item is removed first An array with a top index, or linked nodes
What can change? The agreed behaviour should remain the same The internal representation can change

An ADT is independent of a particular representation; a data structure supplies the concrete organization used to carry out its operations. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/abstractDataType.html?utm_source=openai))

Two Ways to Represent the Same Stack

Array-based stack:
items: [10][20][unused]
top index: 1

Linked stack:
top → [20 | next] → [10 | next] → NULL

In both examples, the next successful pop returns 20. The storage differs, but the LIFO rule is unchanged. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/stack.html))

Important distinction: A C structure definition is not automatically an ADT. It describes fields. An ADT also needs specified operations and rules. ([gnu.org](https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Structures.html?utm_source=openai))

Another Example: Queue ADT

A queue follows FIFO: First In, First Out. Items enter at the rear through enqueue and leave from the front through dequeue. Thus, adding 10 and then 20 makes 10 the first item removed. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/queue.html))

7. Focused C Prerequisite Checklist

Use these tasks to check your readiness. They are suggested practice tasks, not AKTU past-paper questions.

Skill Self-check task
Variables and types Declare a roll number, grade and average.
Conditions and loops Find the largest value in an array.
Functions Write a function that returns an array’s sum.
Arrays Print all elements without going beyond the bounds.
Pointers Change a variable through a pointer.
Structures Store and display one student record.
Memory allocation Allocate one node, check the result and free it.

Suggested order: practise arrays and functions first, then pointers and structures, followed by dynamic allocation. Next, trace stack and queue operations on paper before writing their implementations.

8. Exam-Focused Revision

How to Structure an ADT Answer

  1. Define ADT.
  2. Name an example, such as a stack.
  3. State its rule: LIFO.
  4. List the operations and explain their effects.
  5. Show a short operation trace.
  6. Explain that different representations can preserve the same behaviour.

Common Mistakes to Avoid

  • Describing a stack only as “an array.” Its defining feature is LIFO behaviour.
  • Confusing peek, which reads the top, with pop, which removes it.
  • Calling a record a single field.
  • Assuming that every C implementation uses the same type sizes.
  • Treating an array variable as a pointer variable.

Keep behaviour, logical grouping and memory representation separate in your answers. ([xlinux.nist.gov](https://xlinux.nist.gov/dads/HTML/stack.html))

For related material on this website, visit the TargetSemester Data Structure page.

Sources and Further Reading