Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Built-in Data Types

Built-in data types are those defined by the language. The most basic data types in C++ are built-in data
types. The most common built-in data types are char, int, float, and double. The C++ language standard
defines built-in types (also known as fundamental types), which are incorporated into the compiler.
There are no header files that specify built-in types. Built-in types are classified into three types: integral,
floating-point, and void. Whole numbers are represented by integral types. Values with fractional parts
can be specified using floating-point types. The compiler treats most built-in types as different types.
Some types, however, are synonyms or are considered as equivalent types by the compiler.

Integer Data Type

An integer data type denotes a set of mathematical integers. A number without a fraction is called an
integer. Integral data types can be of various sizes and can contain negative values or not. In a
computer, integers are often represented as a series of binary digits (bits). Because the size of the
grouping varies, so does the set of integer sizes available on different types of computers and
programming languages. The integer data type is used to represent entire integers (no fractional parts).
Integer values jump from one to the next. There is nothing between the numbers 6 and 7. Why not
make all of your numbers floating point, allowing for fractional parts? There are three reasons for this.
To begin with, there are some things in the real world that are not fractional. Second, the integer data
type is often used to control program flow by counting, thus the need for a data type that jumps from
one value to another. Third, integer processing is significantly faster within the CPU than is floating point
processing.

Void Type

The void type is a valueless special type. However, it is useful since it can demonstrate the absence of
any value. The void type denotes a value set that is empty. There can be no variables of type void
provided. The void type is mostly used to declare functions that return no values or generic pointers to
untyped or arbitrarily typed data. Any expression can be explicitly transformed to void or cast to that
type. Such expressions, however, are limited to the following uses, An expression statement, The left
operand of the comma operator. The second or third operand of the conditional operator

Floating-Point Type

In C++, a number having a fraction is referred to as a floating-point type. C++ defines three different
floating-point sizes to make calculation more efficient: float, double, and long double. Floating-point
numbers are all signed. To offer an approximation of fractional values over a wide range of magnitudes,
floating-point types use an IEEE-754 representation. The table below includes the floating-point types in
C++ as well as the relative constraints on floating-point type sizes. These constraints are imposed by the
C++ standard and are unrelated to the Microsoft implementation. The standard does not specify the
absolute size of built-in floating-point types.
Boolean Type

To describe a value that can be either true or false, the C++ language defines a type called Boolean
(named after the French mathematician/philosopher George Bool). The type is called Boolean, however
the type name used in programs is bool, which is a keyword. A Boolean data type has two potential
values (typically labeled true and false), which are intended to represent the two truth values of logic
and Boolean algebra. It is named after George Boole, who established an algebraic logic system in the
mid-nineteenth century. The Boolean data type is most commonly connected with conditional
statements, which enable different actions by modifying control flow based on whether a programmer-
specified Boolean condition evaluates to true or false.

You might also like