Go language data type


Release date:2023-09-08 Update date:2023-10-13 Editor:admin View counts:315

Label:

Go language data type

In Go programming languages, data types are used to declare functions and variables.

The emergence of data types is to divide the data into data with different memory sizes. When programming, you need to use big data to apply for large memory, so you can make full use of memory.

Go languages have the following data types by category:

Serial number

Type and description

1

Boolean values can only be constant true or false. A simple example: var b bool = true.

2

Numeric type integer int and floating point float32, float64,Go language supports integer and floating point numbers, and supports plural numbers, where the operation of bits uses complement.

3

String type: a string is a sequence of characters joined together by a string of fixed-length characters. Go strings are concatenated by a single byte. Bytes of a string in the Go language use UTF-8 encoding to identify Unicode text.

4

Derived type: including: ● (a) pointer type (Pointer) ● (b) array type ● (c)structured type (struct) ● (d) Channel type ● (e) function type ● (f) slicetype ● (g) interface type (interface) ● (h) Map type

Numeric type

Go also has schema-based types, such as: intuint and uintptr .

Serial number

Type and description

1

Uint8 unsigned 8-bit integers (0 to 255)

2

Uint16 unsigned 16-bit integer (0 to 65535)

3

Uint32 unsigned 32-bit integer (0 to 4294967295)

4

Uint64 unsigned 64-bit integer (0 to 18446744073709551615)

5

Int8 signed 8-bit integers (- 128to127)

6

Int16 signed 16-bit integers (- 32768 to 32767)

7

Int32 signed 32-bit integers (- 2147483648 to 2147483647)

8

Int64 signed 64-bit integers (- 9223372036854775808 to 9223372036854775807)

Floating point type

Serial number

Type and description

1

Float32 IEEE-754 32-bit floating point number

2

Float64 IEEE-754 64-bit floating point number

3

Complex64 32-bit real and imaginary numbers

4

Complex128 64-bit real and imaginary numbers

Other numeric types

Other more numeric types are listed below:

Serial number

Type and description

1

Byte is similar to uint8

2

Rune is similar to int32

3

Uint 32 or 64 bit

4

Int is the same size as uint

5

Uintptr unsigned integer, used to store a pointer

Powered by TorCMS (https://github.com/bukun/TorCMS).