# Difference between data type and data structure

**Data Type**

A *data type* is the most basic and the most common classification of data. It is this through which the compiler gets to know the form or the type of information that will be used throughout the code. So basically data type is a type of information transmitted between the programmer and the compiler where the programmer informs the compiler about what type of data is to be stored and also tells how much space it requires in the memory. Some basic examples are int, string etc. It is the type of any variable used in the code.

`#include <iostream.h> ` `using` `namespace` `std; ` ` ` `void` `main() ` `{ ` ` ` `int` `a; ` ` ` `a = 5; ` ` ` ` ` `float` `b; ` ` ` `b = 5.0; ` ` ` ` ` `char` `c; ` ` ` `c = ` `'A'` `; ` ` ` ` ` `char` `d[10]; ` ` ` `d = ` `"example"` `; ` `} ` |

*chevron_right*

*filter_none*

As seen from the theory explained above we come to know that in the code written the variable ‘a’ is of data type integer which is denoted by int a. So the variable ‘a’ will be used as an integer type variable throughout the process of the code. An, in the same way, the variables ‘b’, ‘c’ and ‘d’ are of type float, character and string respectively. And all these are kinds of data types.

**Data Structure**

A *data structure* is a collection of different forms and different types of data having a specific operation that can be performed. It is a collection of data types. It is a collection of organizing the items in terms of memory and also the way of accessing each item through some defined logic. Some examples of data structures are stacks, queues, linked lists, binary tree and many more.

Data structures perform some special operations only like insertion, deletion and traversal. For example, you have to store data for many employees where each employee has his name, employee id and a mobile number. So this kind of data requires complex data which is data structure comprised of multiple primitive data types. So data structures are one of the most important aspects when implementing coding concepts in real-world applications.

**Difference between data type and data structure:**

Data Types | Data Structures |
---|---|

Data Type is the kind or form of a variable which is being used throughout the program. It defines that the particular variable will assign the values of the given data type only | Data Structure is the collection of different kinds of data. That entire data can be represented using an object and can be used throughout the entire program. |

Implementation through Data Types is a form of abstract implementation | Implementation through Data Structures is called concrete implementation |

Can hold values and not data, so it is data less | Can hold different kind and types of data within one single object |

Values can directly be assigned to the data type variables | The data is assigned to the data structure object using some set of algorithms and operations like push, pop and so on. |

No problem of time complexity | Time complexity comes into play when working with data structures |

Examples: int, float, double | Examples: stacks, queues, tree |

## Recommended Posts:

- Difference between Data Scientist, Data Engineer, Data Analyst
- Difference between Data Warehousing and Data Mining
- Difference between Data Warehouse and Data Mart
- Difference between a Data Analyst and a Data Scientist
- Difference between fundamental data types and derived data types
- Change Data Type for one or more columns in Pandas Dataframe
- Applications of Graph Data Structure
- Applications of linked list data structure
- What is the difference between ng-if and data-ng-if directives ?
- Difference between Stack and Queue Data Structures
- GRE Data Analysis | Distribution of Data, Random Variables, and Probability Distributions
- GRE Data Analysis | Numerical Methods for Describing Data
- GRE Data Analysis | Methods for Presenting Data
- GRE Data Analysis | Data Interpretation Examples
- Difference Between High-level Data Link Control (HDLC) and Point-to-Point Protocol (PPP)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.