The purpose of a data type is the set that you can find in all data. By understanding data types, you can also determine whether a value can be had from the data or not. One form of applying data types in everyday life is integers. Because in essence the writing of a number in the data can also vary, such as 5.5 or ¾. The numbers we mentioned are including integers, not like integers 5, 6, 1, 3 and many more.
More concrete types of data can be found in the world of computer programming. In the initial stages of programming, you must first determine the type of data used. Examples of data types that are often used by programmers are Integer, Real, Double, Char, String and many others.
After determining the data type to be used, a programmer will immediately declare it at the beginning of its stage. This is intended to give special restrictions or categories to the data that will be used by the program. The determination of memory can also be determined when the data type has been selected.
Data Type Function
A data type if well understood will certainly function properly too. Both programmers and the wider community will certainly be helped by a good understanding of data types. Had we mentioned before that with the use of good data types, a programmer can provide its own control or restrictions on the program being made. By selecting the data type, the programmer can also determine the memory to be used.
For the wider community understanding data types also provides its own function. One example is about integers and non-integers (decimals, fractions, etc.). When determining a volume of water, you might encounter 1.5 liters of data. But on the calculation of items such as cars will certainly be written in integers. It is not possible for a car to be 8.5 or the other.
Types of data types are primitive (simple) data types and composite data types. what are the two like? let's discuss directly starting from the primitive data types first.
Primitive data types (simple)
Primitive data types are data types that can only store one value for each variable. This data type is a basic data type that is often used by programs. Examples of primitive data types, namely:
A. Numeric Type, this numeric type is used on variables to store values ​​in the form of numbers. This data type is divided into "Integer" and "Real". Real (Real) data types
Real-type constants are numbers that contain decimal points or fraction types. In Pascal there must be at least one digit before and after the decimal point, there must not be a comma and the value can be positive or negative. Can be written in an ordinary or scientific model. Example of a real number: 34.265 -3.55 0.0 35.997E + 11, where E is the rank symbol 10. So 452.13 has a value equal to 4.5213e2.
The value of a data from an integer data type is an integer value as in mathematics. This data representation is a way of how its value is stored in memory. Integer data types are divided into two categories, both signed (unsigned) and unsigned. Signed integers are able to represent negative integer values, while unsigned integers are only able to represent positive integers.
The positive integer representation in a computer is actually a string of bits, using a binary number system. The order of the bits also varies, can be either little endian or big endian. In addition to the size, width or accuracy (precision) of integers also varies, depending on the number of bits they represent. Integers that have n bits can encode 2n. If the integer data type is an unmarked integer, then the range is from 0 to 2n-1.Integer (int) is an integer data type.
B. Character (char), is a data type that stores only one (1) digit character, because the size of one digit is one byte (and 1 byte = 8 bits). for writing characters use single quotes (‘) in front of and behind the characters written. an example like this:
C.Boolean, is a logical data type that only has true (true) and false (false) values. FYI, this data type uses the smallest memory. Usually this data type is used for comparison. Var A, B, C: Boolean; NOT, OR, AND, and XOR operators can be formed together into a complex Boolean expression.
Turbo Pascal for Windows has three types, namely: Boolean, WordBool, and LongBool. The Boolean type uses the smallest memory, while WordBool and LongBool are used to write programs that are compatible with the Windows environment.
Composite data types
This data type is the opposite of the primitive date type, composite data types can hold many values. Among others :
1. Array, or called array. Is a structured data type, although a simple array can store data of the same type (homogeneous) in a variable.
2. Record or Struct, such as arrays, records or structs including composite data. Records are commonly known in the Pascal or Delphi programming languages ​​while structs are better known in C ++. Another thing with arrays, record data types hold different data types (heterogeneous).
3. Image, this data type is a graph data type such as for example a population development chart. in modern visual programming languages, this type of data is already very well supported.
4. Date Time, date and time data values ​​are stored in a specific format. With declared variables or constants, they can be stored properly in the form of "date" and "time" data types. This data type includes a composite data type group, because it is formed from several data types.
5. Object, this type of data store that is associated with objects that normally exist in the VB programming language, Delphi and other programming languages ​​based on GUI (Graphical User Interface). For example: if a form has a Command button control, we name it Command1.
6. Subrange, the type of data numbers that have a certain range of values ​​that have been determined by a programmer. Usually, this data type has maximum and minimum limits.
7. Enumeration, this data type has elements that must be mentioned one by one and has a constant value in the form of an integer in accordance with the order. The value of this constant represents a variable name written in brackets. This data type is often found in Delphi and SQL languages.

0/5 (0 Reviews)

LEAVE A REPLY

Please enter your comment!
Please enter your name here