What is Data Types in Computer Programming language, Example and References

What is Data Type / Data Type?

What is Data Types in Computer Programming language, Example and References
What is Data Types in Computer Programming language, Example and References
West Borneo Blogger - Data Type is a type of value that can be accommodated by a variable.

Types of Data Type / Data Type

1. Primitive data type (Simplified)

Primitive data types are data types that can store one value per one variable. Primitive data types are the basic data types that are often used by programs. Examples of primitive data types are numeric type (integer and real), character data type / char, boolean data type.
1.1. Numeric
The numeric data type is used in variables or constants to store values ??in numeric form. This data type is divided into integers, and real.
1.1.1. Integer
Integer Is a data type in the form of integers, divided into several categories such as table below.
Data Type
Size
Value Range
Byte
1 byte
0 s/d +255
Shortint 
1 byte
-28 s/d +127
Integer
2 bytes
-32768 s/d 32767
Word 
2 bytes
0 s/d 65535
Longint 
4 bytes
2147483648 s/d 2147483647

1.1.2. Real
Real is a number that contains a decimal point or a fractional type.
Data Type
Size
Value Range
real
6 bytes
2.9 x 10-39 s/d 1.7 x1038
single
4 bytes
1.5 x 1045 s/d 3.4 x 1038
double
8 bytes
5.0 x 10-324 s/d 1.7 x 10308
extended
10 bytes
3.4 x 10-4932 s/d 1.1 x 104932
comp
8 bytes
-9.2x 1018 s/d 9.2x 1018

1.2. Character (char)
Characters are data types that are only able to store 1 digit of characters. The size for the character data type is 1 byte (1 byte = 8 bits). There are 256 character types that are character-coded (ASCII), 0 to 255. For character writing using single quotes (') in front and back of written characters. Examples: 'a', 'A', '&' etc.
Values? that include characters are:
A. Character letters: 'a' .. 'z', 'A' .. 'Z'
B. Character number: '0' .. '9'
C. Character punctuation: point, comma, semicolon, colon and so on
D. Special characters: $,%, #, @ and so on.

1.3. Boolean
Boolean is a logical data type, which contains two possible values: TRUE (true) or FALSE (false). Boolean data types use the smallest memory.

2. Composite data type

Composite Data Type is a data type that can hold many values, among others, as follows.
2.1. Array
Arrays or commonly referred to as arrays, are well-structured data types, though still simple. An array is capable of storing a number of data of the same type (homogeneous) in a variable. As an illustration, the array can hold a lot of data but with the same data type, such as integers only. Each location of the array data is given an index number that serves as the address of the data.

2.2. Record or struct
Like Arrays, Records or Structs also include composite data types. Records are known in Pascal / Delphi while Structs are known in C ++. In contrast to arrays, data record types are able to hold large amounts of data with different data types (heterogeneous). For example, an integer part, one more character, and another Boolean part. Usually the record is used to accommodate the data of an object. For example, students have a name, address, age, place of birth, and date of birth. The name will use the string data type, the address of the data type string, the age of the type of data single (numeric), the birthplace of the data type string, and date of birth data type date. Here is an example of using records in Delphi.

2..3. Image
Image, or image, or image, is a graph data type. For example graphs of the development of the number of students SMK, photos of our families, travel videos, and others. In modern programming languages, especially visual based, this data type has been supported very well.

2.4. Date Time
The data values ??for the date and time are internally stored in a specific format. Variables or constants declared with Date data type can be used to store both date and time. This type of data belongs to a group of composite data types, because it is the formation of several data types.

2.5. Object
The object data type is used to store values ??associated with objects provided by Visual Basic, Delphi, and other GUI-based programming languages. For example, if you have a form that has a Command button control, we name it Command1.

2.6. Subrange
Data type subrange is a data type of number that has a certain range of values ??in accordance with the established programmer. Typically, this data type has a minimum value and maximum limit value. This data type is very well supported in Delphi.

2.7. Enumeration
This data type is a data type that has elements that must be called one by one, and is worth of integer constants in the order. The value of the integer constants of this element is represented by a variable name written in parentheses. This data type is also found in Delphi, and declarative programming languages ??such as SQL.

In the example above, the data type Hari_dlm_Minggu includes enumeration with the Zero range range, which is Monday to Sunday and the data value from 0, 1, up to 7. While data type Nama_Bulan includes enumeration with Zero range range, January to December and data value From 0, 1, up to 12.

Other Data Types
1. Structured Data Type
1.1. Data String Type
It is a data that stores arrays, for example 'ABCDEF' is a string constant containing 6 bytes of characters. Place size for this data type is 2 to 256 bytes, with the number of elements 1 to 255.
1.2. Data Set Type
A set is a set of values ??(members). Set is a Data type specific to Pascal. The set in programming is very similar to the set in mathematical sciences.
One of the benefits of using a data set type is to check whether a value appears within a certain range. For example, to determine whether a character is a Lower Case Letter (ie, lower case), eg. Ch is a Char type, we can write, if (Ch> = 'a') and (Ch <= 'z') then Writeln (Ch, 'is lowercase.'); Or, with the set notation, we can write, if Ch in ['a' .. 'z'] then Writeln (Ch, 'is lowercase.');

2. Data Type Pointer
Pointer is a special variable that contains an address (address) in another location in memory. A variable that points (points) to something so called a pointer.
There are two kinds of pointers:
A) Typed (specific): is a pointer that points to a particular data type on a variable.
B) Generic (general): is a pointer that does not point to a particular data type on a variable.

Baca selengkapnya