Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When programmers talk about "data structures", are they only talking about abstract data types like lists, trees, hashes, graphs, etc.?

Or does that term include any structure that holds data, such as composite types (class objects, structs, enums, etc.) and primitive types (boolean, int, char, etc.)?

I've only ever heard programmers use the term to reference complex data structures or abstract data types, however the Wikipedia article that provides a list of data structures includes both composite types and primitive types in the definition, which is not what I expected (even though it does make sense).

When looking around online I see other places that refer to the term "data structure" in the programming sense as only referring to abstract data types, such as this lecture from Stony Brook University's Department of Computer Science which states

A data structure is an actual implementation of a particular abstract data type.

or this wikibook on data structures, which uses the term in sentences like this:

Because data structures are higher-level abstractions, they present to us operations on groups of data, such as adding an item to a list, or looking up the highest-priority item in a queue

So why do I only ever hear programmers referring to complex data structures or abstract data types when they use the term "data structure"? Do programmers have a different definition for the term than the dictionary definition?

share|improve this question
The term evolved over time. The CS crowd normally uses the term for generic types of structures that can hold multiple items of related data (linked lists, trees etc...) –  Oded May 9 '12 at 13:45
isnt it just a terminology thing? a string is actually an array of chars, and it's a data structure which represents a sequence of individual charachters –  Mithir May 9 '12 at 13:46
Isn't "data structure" a self-defined term? It's any structure for storing data! It's kind of hard to take the question seriously. –  Michael K May 9 '12 at 14:12
@Rachel So your question is actually whether primitive data types are data structures or not? if programmers mean something different when they talk about data structures is still polling for opinions though. –  Yannis Rizos May 9 '12 at 14:15
"Primitive" completely depends on scope. At the binary level there is no such thing as an int, for example. At an even lower level there aren't even bits - just electrical bias. Again, this is a self defining term - not a good question at all. –  Michael K May 9 '12 at 14:17

2 Answers 2

up vote 17 down vote accepted

The generic definition of "data structure" is anything that can hold your data in a structured way, so yes this would include composite types and primitive types in addition to abstract data types. For example, a string is a data structure as it can hold a sequence of characters in a structured way.

However, the term also has another meaning to programmers.

Since the term "data structures" is so broad, developers usually use a more specific term to identify what they are talking about, such as class or data object or primitive type, and the specific term used for most complex or abstract data types is "data structure"

This is why you hear "data structure" most frequently being used for abstract data types like Arrays, Lists, Trees and Hashtables, and not for things like primitive data types

share|improve this answer
I think graphs are very common too but they are just rarely represented in standard libraries because they are very hard to build in a generic and efficient way. –  Klaim May 9 '12 at 13:52
So when programmers talk about "data structures", they're usually talking about abstract data types‌​? And although primitive types (such as int, bool, or char) and composite types (like a class, struct, or enum) are still considered data structures by programmers, they are usually referred to by different terms? –  Rachel May 9 '12 at 13:57
@Rachel technically a data structure could be a homebrewed implementation using pointers/classes ect too. I made some very ugly "data structures" similar to lists as part of a C++ homework assignment. We just don't call classes data structures as often because they're usually something more specific. –  Ben Brocka May 9 '12 at 14:07
@BenBrocka Ahhh so "data structure" is a very broad term which does cover these other objects, however its typically better to be more specific when talking about data structures and to use terms like "primitive data type" or "data object" instead of "data structure". And the commonly used specific term for objects like Lists, Trees, Graphs, etc just happens to be "data structures" –  Rachel May 9 '12 at 14:11
@Rachel yes, even though everything is a data structure (strictly speaking) the term 'data structure' usually refers to those abstract data types. I'd say the term 'data structure' from a developer's perspective refers to how he's storing the data. It could be a in memory list, a file in the disk or could be a custom data structure he implemented himself. –  Alex May 9 '12 at 14:13

The term refers to both, though things like ints and booleans are typically considered primitive data types (or primitive data structures). The term itself simply referes to anything that stores data in a specific way. Certainly int meets this definition just as well as something like a Hash table, only it's simpler.

Typically, when people use data structure, they refer to more complex data structures, and not the simpler ones but both meet the definition.

share|improve this answer
I don't think I've ever heard someone refer to an int as a "data structure". –  Qwertie May 9 '12 at 16:12
@Qwertie me neither, but that's still what it is. It's called a "data type" more often, but that pretty much means the same thing as "data structure" –  Oleksi May 9 '12 at 16:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.