Data type is an attribute that can direct a computer system to define its data values. Data types in programming tell the compiler how to use the data, so that the program can be extended.
There are various data types in programming as the data can take the form of variables and in particular, it has a data storage format containing a specific range of values.
When a computer program stores data in the form of variables, certain data types must implement those variables.
Please note that each data type in programming has its own function and how it works according to the program design.
For example, common basic data types in programming can be found in most programming languages. However, there are also complicated types that vary from language to language.
To know more information about what is a data type, check out the following explanation.
Integer is a data type that takes the form of a numeric or whole number and serves to store numbers without fractions. The range of numbers that can be stored is -707, 0, to 707.
This data type is also considered more efficient than other integer types, such as long or short. Integer consists of several data types, including:
The next data type in programming is floating point. A floating point is used to store numbers that have fractional components, such as 0.7, 707.0, and others.
What distinguishes a floating point from an integer is that floating point numbers contain fractions, while integers do not. There are several types of floating point, namely:
Character is a data type that serves to store a symbol, punctuation mark, number, blank space, or letter.
This data is a single character with quotation marks (') enclosing the character. Since it follows Unicode rules, typed numbers must be preceded by the code "/u". However, you can also use hexadecimal numbers from 0000 to FFFF.
The boolean data type represents false and true numeric values. The value is represented by 0 for false and 1 for true.
Furthermore, booleans only represent two values of the greater and lesser number relationship.
Array serves to archive elements of the same data. An example of an implementation of this data type is a calorie counter application that stores many types of exercise performed. The stored elements are then applied with an integer index (0,1,3,4, and so on).
This data type is usually used in Object Oriented Programming or OOP. An example of implementing this data type is programming to build a house.
The designed physical house object is obtained from the blueprint of the house, or commonly called a class.
The next data type is a string, which is quite popular in the programming world. A string is a set of data and characters used to store text.
In programming, strings can add symbols and numbers that will be treated as text.
Enumerated is a collection of constants whose values can be self-defined. Enum can be either text or numeric data.
The last programming data type is the date, which can store dates and other programming information. This data type is a combination of numeric and integer data types.
Usually, a date is an integer value, so it can be used to perform basic math operations, such as counting the days associated with an event.
The nothing or nullable data type mentions that a code does not have a value. This means that there may be code that is left out, or wrong, or the value does not match the specified logic.
The void data type confirms to the programmer that there is a value that cannot be processed. The sign of unprocessable code is that the code does not respond.
Risca Fadillah
Subscribe to Our Newsletter
Enter your email to receive news from us