Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the data types in Go

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article is about what data types are in Go. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

In the Go programming language, 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.

The Go language has the following data types by category:

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

two。 Numeric types: integer int and floating-point float32, float64,Go language supports integer and floating-point numerals, and natively supports complex numbers, where bit operations are complemented.

3. String type:

A string is a sequence of characters connected 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:

These include:

(a) pointer type (Pointer)

(B) Array type

(C) structured types (struct)

(d) Channel type

(e) function type

(F) slice type

(G) Interface type (interface)

(h) Map type

Numeric type

Serial number type and description 1uint8

Unsigned 8-bit integer (0 to 255) 2uint16

Unsigned 16-bit integer (0 to 65535) 3uint32

Unsigned 32-bit integer (0 to 4294967295) 4uint64

Unsigned 64-bit integer (0 to 18446744073709551615) 5int8

Signed 8-bit integers (- 128to127s) 6int16

Signed 16-bit integer (- 32768 to 32767) 7int32

Signed 32-bit integer (- 2147483648 to 2147483647) 8int64

Signed 64-bit integers (- 9223372036854775808 to 9223372036854775807)

Floating point type:

Serial number type and description 1float32

IEEE-754 32-bit floating point number 2float64

IEEE-754 64-bit floating point number 3complex64

32-bit real and imaginary 4complex128

64-bit real and imaginary numbers

Other numeric types:

Serial number type and description 1byte

Similar to uint82rune

Similar to int323uint

32-or 64-bit 4int

Same size 5uintptr as uint

Unsigned integer, used to store a pointer thank you for reading! This is the end of this article on "what are the data types in Go?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report