C and C++ basic types In
C and
C++, there are minimally four types, char, int, float, and double, but the qualifiers short, long, signed, and unsigned mean that C contains numerous target-dependent integer and floating-point primitive types.
C99 allowed the modifier long to be used twice in combination with int (e.g. long long int). Similarly, signed and unsigned can be used as modifiers for integral types.
C23 introduced the bool type as a core data type, while it was always a core data type of C++. C++ also features a std::byte type (similar to Java). C and C++ also contain size_t, intptr_t and other integer types, for things like indexing arrays and collections. These are not distinct data types, but often aliases and are system-defined. These are perhaps similar to Rust usize and isize.
Java The basic types of Java are similar to that of C. The
Java virtual machine's set of primitive data types consists of: • byte, short, int, long, char (
integer types with a variety of ranges) • float and double,
floating-point numbers with single and double
precisions • boolean, a
Boolean type with logical values true and false • returnAddress, a value referring to an executable memory address. This is not accessible from the Java programming language and is usually left out.
XML Schema The
XML Schema Definition language provides a set of 19 primitive data types: • string: a
string, a sequence of
Unicode code points • boolean: a
Boolean • decimal: a number represented with
decimal notation • float and double:
floating-point numbers • duration, dateTime, time, date, gYearMonth, gYear, gMonthDay, gDay, and gMonth:
Calendar dates and times • hexBinary and base64Binary:
binary data encoded as
hexadecimal or
Base64 • anyURI: a
URI • QName: a
qualified name • NOTATION: a QName declared as a notation in the schema. Notations are used to embed non-XML data types. This type cannot be used directly - only derived types that enumerate a limited set of QNames may be used.
JavaScript In JavaScript, there are 7 primitive data types: string, number, bigint, boolean, symbol, undefined, and null. Their values are considered
immutable. These are not objects and have no
methods or
properties; however, all primitives except undefined and null have
object wrappers.
Visual Basic .NET In
Visual Basic .NET, the primitive data types consist of 4 integral types, 2 floating-point types, a 16-byte decimal type, a Boolean type, a date/time type, a Unicode character type, and a Unicode string type.
Rust Rust has primitive unsigned and signed fixed width integers in the format u or i respectively followed by any bit width that is a power of two between 8 and 128 giving the types u8, u16, u32, u64, u128, i8, i16, i32, i64 and i128. Also available are the types usize and isize which are unsigned and signed integers that are the same bit width as a reference with the usize type being used for indices into arrays and indexable collection types. Rust also has: • bool for the
Boolean type. • f32 and f64 for 32 and 64-bit
floating point numbers. • char for a
unicode character. Under the hood these are unsigned 32-bit integers with values that correspond to the char's codepoint but only values that correspond to a valid unicode scalar value are valid. == Built-in types ==