Translate

Thursday, 26 April 2012

Primitive Data types


In computer science, primitive data type is either of the following:
  • basic type is a data type provided by a programming language as a basic building block. Most languages allow more complicated composite types to be recursively constructed starting from basic types.
  • built-in type is a data type for which the programming language provides built-in support.
primitive  Data types include:

Integer numbers

An integer data type can hold a whole number, but no fraction. Integers may be either signed (allowing negative values) or unsigned (nonnegative values only). Typical sizes of integers are:

SizeNamesSigned RangeUnsigned Range
8 bitsByte−128 to +1270 to 255
16 bitsWord, short int−32,768 to +32,7670 to 65,535
32 bitsDouble Word, long int (win32, win64, 32-bit Linux[1])−2,147,483,648 to +2,147,483,6470 to 4,294,967,295
64 bitslong int (C in 64-bit linux[1]), long long (C), long (Java, the signed integer variant only[2]))−9,223,372,036,854,775,808 to +9,223,372,036,854,775,8070 to 18,446,744,073,709,551,615
unlimitedBignum

Booleans

boolean values may be implicitly converted to integers, according to the mapping false → 0 and true → 1 (for example, true + true would be a valid expression evaluating to 2). The boolean type bool in C++ is considered an integral type and is a cross between numeric type and a logical type.

No comments: