• Data Types are necessary for delimiting semantics.In Programming languages, only some combinations of operations are useful and others are not.
For example: It doesnot make sense to add a number to a string of characters.
Declaring Data Type helps the compiler to detect such possible logical errors in the code.The operation above in the example doesnot make any sense so it is prompt to give an error.
• Data Types allow a complier to reserve right amount of memory for a given variable.If we don’t define a data type at the time of variable declaration, compiler would not know how much memory is to be reserved for the declared variables.
• In C language, we have different data types such as char for character, int for integer.
Not defining data type would mix up our data and it would be hard to distinguish between characters and numbers stored in the variables with no data type for the compiler.
• Data Types save the programmers from duplicating the work to implement same, often-needed data . For example, most languages have floating-point numbers. If not for them, programmers would have to have a library of floating-point subroutines, and they would have to call the library whenever they need floating-point numbers.