As a program developer, generally will not be limited to understand a language, with the understanding of language, often will be mixed, in order to facilitate memory, deliberately summed up the Java, PHP, C + + language data types, easy to compare, memory.
1.Java Language
basic types and reference types
|
Basic type |
Integral type |
Byte 1 bytes |
|
Short 2 bytes |
|
Int 4 bytes |
|
Long 8 bytes |
|
Char 2 bytes Store Unicode code, assigned in single quotation marks |
|
Floating-point type |
Float 4 bytes |
|
Double 8 bytes |
|
Boolean type |
Looean |
|
Reference type |
|
Class Type |
|
Interface type |
|
Array type |
|
Null type |
Hexadecimal integer constants: In hexadecimal, you need to start with a 0x or 0X, such as 0xff,0x9a.
Octal integer constant: octal must start with 0, such as 0123,034.
Long integer: Long type must end with L, such as 9l,342l.
Floating point constants: Because the default type of a decimal constant is a double, you must add F (f) to the back of the float type. The same variable with a decimal number defaults to the double type. 2. PHP Data Type
PHP supports eight original types (type).
|
Four scalar types |
String (strings) |
|
Integer (integral type) |
|
Float (floating-point type, also double) |
|
Boolean (Boolean) |
|
Two types of composite |
Array (arrays) |
|
Object (Objects) |
|
Two special types of |
Resource (resources) |
|
Null (empty) |
data types in 3.c++
|
Data type name |
Number of bytes |
Alias |
Take value range |
|
Int |
* |
signed,signed int |
Determined by the operating system, which is related to the "word length" of the operating system (VC + + is 4 bytes, 32 bits). ) |
|
unsigned int |
* |
Unsigned |
Determined by the operating system, which is related to the "word length" of the operating system |
|
__int8 |
1 |
char,signed Char |
–128 to 127 |
|
__int16 |
2 |
Short,short int,signed Short int |
–32,768 to 32,767 |
|
__int32 |
4 |
signed,signed int |
–2,147,483,648 to 2,147,483,647 |
|
__int64 |
8 |
No |
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
|
bool |
1 |
No |
False or True |
|
Char |
1 |
Signed Char |
–128 to 127 |
|
unsigned char |
1 |
No |
0 to 255 |
|
Short |
2 |
Short int,signed Short int |
–32,768 to 32,767 |
|
unsigned short |
2 |
unsigned short int |
0 to 65,535 |
|
Long |
4 |
Long int,signed Long int |
–2,147,483,648 to 2,147,483,647 |
|
Long Long |
8 |
None (but equivalent to __int64) |
–9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
|
unsigned long |
4 |
unsigned long int |
0 to 4,294,967,295 |
|
Enum |
* |
No |
Determined by the operating system, which is related to the "word length" of the operating system |
|
Float |
4 |
No |
3.4E + + (7 digits) |
|
Double |
8 |
No |
1.7E/+ 308 (digits) |
|
Long double |
8 |
No |
1.7E/+ 308 (digits) |
|
wchar_t |
2 |
__wchar_t |
0 to 65,535 |
(P: The size of the pointer is a fixed value of 4 bytes)
float and double
Float:1 bit sign bit (s), 8-bit exponent (e), 23-bit mantissa (m, total 32 digits)
Double:1 bit sign bit (s), 11-bit exponent (e), 52-bit mantissa (m, 64-bit) C + + standard, float can only guarantee 6-digit valid digits, double type at least 10-digit valid digits guaranteed. As for the specific display after the decimal point, look at the compiler settings.