Home > Common Problem > body text

What are the data types?

藏色散人
Release: 2019-08-03 11:05:15
Original
53921 people have browsed it

What are the data types?

What are the data types?

The definition of a data type in a data structure is the collective name of a set of values ​​with the same properties and a set of operations defined on this set of values.

Variables are where values ​​are stored. They have names and data types. The data type of a variable determines how the bits representing those values ​​are stored in the computer's memory. You can also specify the data type of a variable when declaring it. All variables have a data type to determine what kind of data can be stored.

Data types include primitive types, tuples, record units, algebraic data types, abstract data types, reference types and function types.

Definition

In computers, data is represented by bits (0 or 1). The smallest addressing unit of data is called a byte (usually eight bits). The unit of machine code instruction processing is called the word length. Most instruction interpretations of word lengths are mainly based on binary. For example, a 32-bit word length can represent an unsigned integer value from 0 to 2 to the power of 32 minus 1, or it can represent an unsigned integer value from negative 2 to 32. A signed integer value raised to the power 2 raised to the 32nd power minus 1. Special arithmetic instructions exist that use different interpretations of the bits in the word length as floating point numbers.

The emergence of data types is to divide data into data with different memory sizes. When programming, you need to apply for large memory only when you need to use big data, so that you can make full use of the memory. For example, if a fat person has to sleep in a double bed, give him a double bed, while a thin person can get a single bed.

According to the default regulations, if the data type is not specified in the declaration, the data type of the variable is Variant. The Variant data type is like a chameleon—it can represent different data types in different situations. When you specify a variable as a Variant variable, you do not have to convert between data types; Visual Basic automatically completes the necessary conversions.

However, if you know that a variable always stores data of a specific type, and you declare a variable of that specific type, Visual Basic can handle this data more efficiently. For example, a variable that stores a person's name is best represented as a String data type because names always consist of characters.

In addition to variables, data types are also used in other situations. When assigning a value to a property, the value has a data type; the parameters of the function also have a data type. In fact, in Visual Basic, everything that has to do with data has to do with data types.

The above is the detailed content of What are the data types?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template