4 programming language basic data types and their range of values (C++,JAVA,PYTHON,GO)

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

1 C + +

The basic types defined by C + + include arithmetic types and void types. The arithmetic types are categorized as Integer (including character and Boolean) and floating point type, as shown in the following table:

c++11 New char16_t,char32_t(the smallest Unicode character type, respectively), Long Long 3 built- in types, with a minimum of four bits of long shaping.

For The four-bit platform, theint type and long type are usually the same word length, occupying a total of three.

You can use the following statements to test the number of bytes for each type:

std::cout <<sizeof(long) <<std::Endl;

2 Java

The size of the storage space that the Java base type occupies is constant, non-referenced, stored on the stack.

All numeric types in Java have a sign and no unsigned numeric type.

3 Python

in the Python in which Each value has a data type, but you do not need to declare the data type of the variable. Python analyzes the type of each variable based on its initial assignment and internally tracks it.

Python There are several built-in data types. Here are some of the more important ones:

1) booleans[Boolean] or true[true] or False[FALSE].

2) Numbers [Numeric type]can beintegers[integer] (1and the2),Floats[FloatingPoints] (1.1And1.2)、Fractions[Score] ( theAnd2/3); even theComplex Number[plural].

3 )      strings Span style= "COLOR: #222222" >[String type] Unicode character sequence, for example: a copy of HTML document.

4 )      bytes [bytes] < Span style= "Font-family:times New Roman" > Byte Arrays [byte array] For example : a copy of JPEG image file.

5) Lists[list] is an ordered sequence of values.

6) tuples[tuple] is an ordered and immutable sequence of values.

7) sets[collection] is a package filled with unordered values.

8) dictionaries[dictionary] is an unordered package of key-value pairs.

4 Go

The basic types of Go languages include:

1) bool(true, False)

2) number type (signed / unsigned)

3) string(built-in "UTF-8" support)

4) Array([n]<type>)

5) sliced slice(array[i:j])

6) dictionary map(map[<from_type>]<to_type>)

7) channel Chan

8) Error

The Go language integer types and ranges are shown in the following table:

Floating-point types are shown in the following table:

Thanks for reading!

Resources:

1 C + + Primer (5th Edition)

2 Thinking in Java (4th Edition)

3 Learning Python (5th Edition)

4 Dive into Python 3 http://woodpecker.org.cn/diveintopython3/native-datatypes.html

5 Programming in Go

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.