Well, somehow even after reading in a lot of textbooks (really a lot) and on the Internet for a long while I still can’t completely comprehend what the difference between the two mentioned things is.
To simplify the question, according to let’s say Wikipedia a data type is:
a classification identifying one of various types of data, such as real, integer or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of that type can be stored.
with it being mostly the implementation of some Abstract data type like the real numbers or the whole numbers.
All good, then comes the data structure:
is a particular way of organizing data in a computer so that it can be used efficiently.[1][2] Data structures can implement one or more particular abstract data types., which are the means of specifying the contract of operations and their complexity. In comparison, a data structure is a concrete implementation of the contract provided by an ADT.
So a data structure is an implementation of an ADT like say a stack or queue.
But wouldn’t that make it a data type as well??
All that I can truly see is that a data type could range from really simple things without any structural organization to sophisticated structures of data what really counts is that they are an implementation of an ADT mirroring the important aspects of it and that they could be envisioned as a single entity like ( a list or tree), but data structures must contain at least some sort of logical or mathematical organization to classify as a data structure, but sadly this difference would make many entities both a data structure and a data type simultaneously.
So what is the solid difference between a simple plain (data type) and a (data structure)?
I would gladly accept an answer with specifying a specific book about this topic which goes deep enough to explain all this matters, also if someone can recommend me some good books about data structures in C.
In C, a data type is a language-level construct. There are a limited number of predefined types (int, char, double, etc.), and a practically unlimited number of derived types (array types, structure types, union types, function types, pointer types, atomic types (the latter are new in C11)).
Any type may be given a simple name via a typedef declaration. For any type other than a function type or an incomplete type, you can have objects of that type; each object occupies a contiguous region of memory.
The types that can exist in C are completely described in section 6.2.5 of the C standard; see, for example, the N1570 draft.
A data structure, on the other hand, is a construct defined by your own code. The language does not define the concept of a linked list, or a binary tree, or a hash table, but you can implement such a data structure, usually by building it on top of derived data types. Typically there is no such thing as an object that's a linked list. An instance of a linked list data structure consists of a collection of related objects, and only the logic of your code turns that collection into a coherent entity. But you'll typically have an object of some data type that your program uses to refer to the linked list data structure, perhaps a structure or a pointer to a structure.
You'll typically have a set of functions that operate on instances of a data structure. Whether those functions are part of the data structure is a difficult question that I won't try to answer here.
An array, for example, can be considered both a data type and a data structure; more precisely, you can think of it as a data structure implemented using the existing array type.
Referring >=C99:
The are two kinds of data types:
char, int, float, double, _Complex, _Bool, void (for some of them there a variation to long and unsigned around)The latter are build from the former and/or the latter.
So to answer your question:
So what is the solid difference between a simple plain (data type) and a (data structure)?
A "data structure [type]" is derived from "simple plain data type"(s) and/or other "data structure [type]"(s).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With