A data structure is a way of organizing data in memory so that the operations you need, such as search, insert, delete, or traverse, are efficient. C gives you only arrays, structs, and pointers, so every list, stack, tree, and hash table is built from those pieces. This section covers the vocabulary (linear vs non-linear, static vs dynamic, abstract data types) and how to choose a structure before you build specific ones in the sections that follow.
Pick by operations.
Write down the operations you need most (lookup, insert, delete, order) and choose the structure that makes those cheap.
Path
Learning Path
Work through the stages in order, or jump to a topic from the index below (6 tutorials).
Common mistakes when learning data structures in C.
early
Choosing by habit
Reaching for an array or list every time ignores what your program actually does most.
over
Over-engineering
A plain array is often fastest for small data. Do not build a tree for ten items.
mix
Mixing structure and use
Keep the structure behind a small set of functions so you can swap it later.
Remember
Key Takeaways
Structures trade speed, memory, and complexity.
C builds all of them from arrays, structs, and pointers.
Choose by the operations you need.
One line: A data structure is a way of organizing data in memory so that the operations you need, such as search, insert, delete, or traverse, are efficient.
Frequently Asked Questions
They are ways to organize data in memory, such as arrays, linked lists, stacks, queues, trees, heaps, hash tables, and graphs, built using arrays, structs, and pointers.
Only arrays and structs (plus unions and enums). More complex structures must be implemented by the programmer or provided by a library.
Start with arrays and linked lists, then stacks and queues, trees, hash tables, and graphs.