Data Structure

a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

Language has primitive and non-primitive data types.


In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods or properties. There are 7 primitive data types.

In C language supports four primitive types - char, int, float, void. Primitive types are also known as pre-defined or basic data types.


JavaScript non-primitive types are objects. An object holds a reference/address of a single key-value pair or many key-value pairs. Whenever we refer to an object, we refer to an address in memory which contains the key-value pair.

The non-primitive data structures in C are also known as the derived data structures as they are derived from primitive ones. A large number of values can be stored using the non-primitive data structures.

When we study data structures, we learn to make new data structures with the native data structures (data types) implemented by our language of choice. We would implement functions to add constraints and/or behaviour on non-primitive data structure to hold primitive data as intended.

Sometimes, we implement data structure that cooresponds to a popular abstract data type, like a queue, stack, a tree. These are abstract data types. And if you look at any beginner data structure guide. They say you can commonly identify these data structure with the following characteristics:


For instance you can see Wiki's Queue (abstract data type) quoted for queue: "A queue is an example of a linear data structure, or more abstractly a sequential collection."

Here is my conundrum, a languages primitive and non-primitive data types are all just data structures in and of itself when it was implemented.

if they are just data structures. Then are those characteristics above also applicable to describe these data types? Would this be correct, an int is a data type of C, it is a data structure related to hold the mathematical range of numbers. Behind an interface, the data structure allows users to manipulate the bits that represents numbers. Because bits are lined up in on contiguous memory, it is linear. it is static for C, but maybe more dynamic in Javascript. Identifying whether it is homogenous, may be difficult. But, I would assume it is homogenous, because in each bit, it represent a concept of a number. brute force adding a sequence of bit representing a char to a primitive number would mistaken the purpose of its primitive data structure - and I assume that is often not allowed in higher language.

  • $\begingroup$ I can't understand what you are asking. What do you mean by "comes about from describing..."? Can you make your question more specific and concrete? Can provide a self-contained definition of what you mean by linear, by homogenous, and by static/dynamic in this context? Can you tell us what you've been reading and give us context for where you've encountered this perspective? $\endgroup$
    – D.W.
    Dec 7, 2022 at 21:19
  • 2
    $\begingroup$ What is your definition of "linear"? What is your definition of "homogenous"? What is your definition of "static"? A term means exactly what the person using the term defines it to mean. No more, no less. Without knowing the definitions of those terms, it is impossible to answer the question. $\endgroup$ Dec 7, 2022 at 21:49
  • $\begingroup$ Primitive means it is not constructed from simpler data types. $\endgroup$ Dec 8, 2022 at 10:16
  • $\begingroup$ If you are confident you understand the question, I encourage edit the question to incorporate that information into the question, so people don't need to read the comments to understand what is being asked. $\endgroup$
    – D.W.
    Dec 8, 2022 at 19:31
  • $\begingroup$ @D.W. I polished up the question a bit - wonder if you can enlighten me. Apologies if it was confusing. $\endgroup$
    – cozycoder
    Dec 9, 2022 at 21:16

3 Answers 3


Primitive data types are predefined entities that the language handles atomically. They have no structure. E.g. a floating-point number.

Data structures are user-defined aggregates created using the primitive data types and the aggregation rules supported by the language. E.g. a list of pairs of integers.

An Abstract Data Type is a data structure that is incompletely specified, i.e. such that some design freedom remains. All that matters is a set of supported operations, regardless how the structure is implemented. E.g. a priority queue.

It would be an abuse to say that a primitive data type is a static, linear list of bits, because these are always handled collectively and not in isolation. (By the way, no modern CPU handles single bits, not even as the types boolean nor bitfield.)


I think you're placing more emphasis than is warranted in these "characteristics" (linear, etc.). At best, those are common patterns that might be helpful to recognize. But they are not some fundamental property of data structures, they are fuzzy (not precisely defined), and so you can use them if they are useful and not use them if they are not useful.

I don't think it's useful to try to argue over whether an 'int' should be considered 'linear' or not. The concept of 'linear' isn't precisely enough defined to come to any objective conclusions, and in any case, the answer doesn't really matter. I recommend spending your time and attention on something else. I also recommend learning data structures from a good textbook. Resources on the Internet are of highly varied quality.

  • $\begingroup$ I'm glad you pointed this bit out, "they are fuzzy (not precisely defined), and so you can use them if they are useful and not use them if they are not useful." $\endgroup$
    – cozycoder
    Dec 10, 2022 at 21:55
  • $\begingroup$ yeah..you are right that it isn't useful to debate whether they are linear or not. In addition that they can be implemented completely differently by different group/reasons. I kinda tunnel visioned because I wanted to understand how do these concepts apply from high level to low level. Since many data structures are constantly implemented on top of each other, I'd like to see where it ends. If they are fuzzy at the primitive level, then I guess I'll just have to accept that. Thank you. $\endgroup$
    – cozycoder
    Dec 10, 2022 at 22:21

It sounds like a very muddled analysis.

"Data structures" are fundamentally a system of addressing - the management of the placement of values in a systematic way.

It is not merely a "collection" of data values, but a collection that is ordered or arranged in a particular way. It is no more concerned with the "relationships" amongst values, than the postcoding of domestic premises is concerned with "the relationships between neighbours".

And it is definitely not concerned with the "functions or operations" that can be applied to the data - this is a constraint handled by data typing.

The only native data type in the computer as we know it, is the binary "bit". All other types essentially consist of a structured series of bits, handled as a single unit.

And not all types are distinguished by structure. The difference between byte and char, for example, is purely in the nominal type which reflects their different practical usage - their internal structure is completely identical.

To my eye, your description of a "data structure" resembles the definition of an "object" (in the sense of object-oriented programming).

The same is true of your definition of "primitives". Most object-oriented languages have this notion of "non-objects" which they call "primitives".

But in non-OO languages like C, there are no "objects", and "primitives" simply mean the types specified by the language designers as fundamental in their language. These primitives contrast with any composite types defined by the programmer.

The selection of primitives provided by C has more to do with programmer convenience and correspondence with the facilities provided by typical hardware, than with being strictly fundamental in computer science.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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