Datatypes are used to identify the attributes of data that the programming language is dealing with. In day to day life we deal with many types of data for example integers, whole numbers, decimal numbers, words, and so on. To solve day to day problems we need to have something in programming languages that can tell the compiler what kind of data it is. So a good programming language will have a good variety of data types to account for all the use cases. The datatypes tells the compiler about the attributes of the data so it can perform operations specific to that datatype so as to not produce an error.