Various language data type sizes

Source: Internet
Author: User

Short,long is used to qualify integer types, such as short int n;long int m; In such a declaration of variables, int can omit: short n; long m; both qualifiers are introduced to provide integers of different lengths. In different hardware and software environments, the length of the Int,short,long may not be the same, but can be determined to be 16 (bit) <=short<=int<=long, long>=32 (bit)

    1. The signed,unsigned is used to qualify char or int. Represent signed Char/int and unsigned char/int, respectively.
    2. Long can also be used to qualify a double (C99 standard), and its size is also related to implementation
    3. A long long int was introduced into the C99 standard

the length of the variable (VC6 environment)

    • Char 8 (BIT)
    • Short 16
    • int 32 is usually the same length as the specific machine
    • Long 32
    • Float 32
    • Double 64

Range of Variables (VC6 environment)

    • Signed char-128~127
    • unsigned char 0~255
    • Signed short-32768~32767
    • unsigned short 0~0xffff
    • Signed Int (-2147483647-1) ~2147483647
    • unsigned int 0~0xffffffff
    • Signed Long ( -2147483647L-1) ~2147483647
    • unsigned long 0~0xfffffffful
    • Float 1.175494351e-38f/* min Positive value */3.402823466e+38f * * Max value */
    • Double 3.3621031431120935063e-4932l */min Positive value */1.189731495357231765e+ 4932L/* Max value */

****

The struct defaults to a null byte when its argument defaults to 8, less than 8, or an integer multiple of 4. 8 has a much higher integer multiplier performance

======================================================================

    • C + + data type length issues:
      One, byte and word length
      Byte, eight bits is a byte, is a fixed concept. Word length refers to the amount of binary data that a computer can process at a time and is a non-fixed concept. For example, a 8-bit computer has a word length of 8, a byte, a 32-bit computer with a word length of 32, or 4 bytes, and, similarly, a 64-bit computer with a length of 64, or 8 bytes.
      Ii. data types in C + +
      1, character data char, the type is always a byte long, that is, 8 bits.
      2, Shaping int, short integer and long plastic shape. usually int is a word length, short is half word, long is one or 2 words (one word length in a 32-bit machine).
      3, floating point float, double dual precision, and long double, respectively, represents a single-precision floating-point number of double-precision floating point numbers and extended precision floating points. Typically, float is a word, double is two characters, and a long double is three or four characters.

======================================================================

Java language

Basic type Size Minimum value Maximum Value
Boolean ----- ----- ------
Char 16-bit Unicode 0 Unicode 2^16-1
Byte 8-bit -128 +127
Short 16-bit -2^15 +2^15-1
Int 32-bit -2^31 +2^31-1
Long 64-bit -2^63 +2^63-1
Float 32-bit IEEE754 IEEE754
Double 64-bit IEEE754 IEEE754

Various language data type sizes

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.