Many people stop right after learning a programming language, but the real foundation of becoming a good programmer is data structures. How to arrange data so you can work with it quickly and efficiently — that is the core of data structures.
Why are data structures important?
Think of a library. If the books are placed randomly, it could take hours to find a single one. But arranged by subject, you find it in an instant. It is the same in a program — choosing the right data structure makes your code fast and effective.
Choosing the right data structure means solving half the problem before you even start.
1. Array — data arranged in sequence
An array is a way to store several values of the same kind one after another. Each slot has an index, which starts from 0:
int marks[5] = {70, 85, 90, 60, 75};
printf("%d\n", marks[2]); // 90 — the third slot
int total = 0;
for (int i = 0; i < 5; i++) {
total += marks[i];
}
printf("Total: %d\n", total);
The advantage of an array — you can reach any slot instantly using its index.

2. Stack — last in, first out
A stack works on the LIFO (Last In, First Out) principle. Think of a stack of plates — the plate placed on top is the one taken off first.
push— place a new element on top.pop— remove the element from the top.
Uses: the browser's "back" button, undo in a code editor, managing function calls — all rely on a stack.
3. Queue — first in, first out
A queue works on the FIFO (First In, First Out) principle — just like the line at a ticket counter. Whoever stands in line first gets served first.
enqueue— add a new element at the end of the line.dequeue— remove an element from the front of the line.
Uses: a printer's job list, CPU scheduling, any waiting list.
Where to use which one?
- Array: a fixed number of elements that you need to reach quickly by index.
- Stack: where the most recent task must be brought back first (undo, back).
- Queue: where tasks must be completed in order, fairly.
Final words
Array, Stack, and Queue are the gateway to data structures. Once you master them well, advanced topics like Linked List, Tree, and Graph will feel much easier. The DCCPS Learning Hub offers the chance to practice these step by step.
Discussion
9