# Data Structure in C

A data structure is a way to store and organize data in a computer so that it can be used efficiently.

A data structure is a logical model of a particular organization of data.

We talk about data structure as:

- Mathematical / Logical Model or Abstract Data Types
- Implementation

## Abstract Data Type

It defines data and operations but has no implementation.

The various data structures are divided into the following categories:

- Linear Data Structure
- Non-Linear Data Structure

## Linear Data Structure

A data structure whose elements are in the form of sequence and every element in the structure has a unique predecessor (*pre-existing*) and unique successor (*inheritor*).

Example – Linked List, Arrays, Stacks, and Queues

## Non-Linear Data Structure

A data structure whose elements are not in the form of sequence and there is no unique predecessor (*pre-existing*) and unique successor (**inheritor**).

Example – Trees and Graphs

## Classification of Data Structure

- Primitive Data Structure
- Non-Primitive Data Structure

### Primitive Data Structure

The primitive data structure is the data structure that is already defined in the C language. They can be used to store only a single value and have a fixed size that can’t be increased or decreased. They allocate memory in the main memory before execution.

Examples in C Language: int, char, float, double, etc.

### Non-Primitive Data Structure

The non-primitive data structures in C are also known as the **derived data structure**. Because the non-primitive data structures are derived from the primitive data structures. The data stored in the non-primitive data structures can be manipulated using operations like insertion, deletion, searching, sorting, etc.

Examples in C Language: array, linked-list, queue, stack, tree, graph, etc.