Size of sizeof of each type under 32-bit and 64-bit machines

Source: Internet
Author: User

The running result is as follows: (the difference between the two is marked with blue and red respectively)

 

--------------------------

Machine Platform: x86_64 Processor

Operating System: Red Hat 4.1.2-14

Compilers: GCC version 4.1.2 20070626

 

Size of char is:                    1

Size of unsigned char is:            1

Size of signed Char is:                1

 

 

Size of int is:                                   
4

Size of short is:                               
2

Size of Long is:                                 
8

Size of long int is:                          
8

Size of signed int is:                         4

Size of unsigned int is:                     4

Size of unsigned long int is:             8

Size of long int is:                    8

Size of unsigned long is:          8

 

 

 

Size of float is:                  4

Size of double is:               8

Size of Long double is:       16

 

 

 

Size of (void *) is:         8

Size of (char *) is:         8

Size of (int *) is:           8

Size of (long *) is:         8

Size of (long *) is: 8

Size of (float *) is:        8

Size of (double *) is:    8

 

 

--------------------------

 

 

 

Machine Platform: x86_32 Processor

Operating System: Windows XP SP2

Compiler:  C ++ compiler that comes with vs2005

 

 

Size of char is:                          1

Size of unsigned char is:            1

Size of signed Char is:         1

 

 

 

Size of int is:                     4

Size of short is:                  2

Size of Long is:                   4

Size of long int is:              4

Size of signed int is:           4

Size of unsigned int is:        4

Size of unsigned long int is:       4

Size of long int is:              8

Size of unsigned long is:      8

 

 

 

Size of float is:                  4

Size of double is:               8

Size of Long double is:        8

 

 

 

Size of (void *) is:       4   

Size of (char *) is:       4

Size of (int *) is:           4

Size of (long *) is:         4

Size of (long *) is: 4

Size of (float *) is:        4

Size of (double *) is:      4

Reference 2:

 Table Format: Below 32-bit machines

Data Type Description Bytes Value Range
Bool Boolean 1 True, false
Char Character Type 1 -128 ~ 127
Unsigned char Unsigned character type 1 0 ~ 255
Short Short integer 2 -32768 ~ 32767
Unsigned short Unsigned short integer 2 0 ~ 65535
Int Integer 4 -2147483648 ~ 2147483647
Unsigned Unsigned integer 4 0 ~ 4294967295
Long Long Integer 4 -2147483648 ~ 2147483647
Unsigned long Unsigned long integer 4 0 ~ 4294967295
Float Single precision type 4 -3.4 × 10-38 ~ 3.4 × 10-38
Double Double Precision type 8 -1.7 × 10-308 ~ 1.7 × 10-308
Long double Long dual-precision type 8 -1.7 × 10-308 ~ 1.7 × 10-308

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.