Data Types
The C language has defined a set of types that can be divided into four general categories:
void, integral, floating-point and derived.
Void type:
The void type, designated by the keyword void, has no values and no operations, although having no values and operations might seem unusual, the void type is a very useful data type.
Integral type:
The C language has three integral types: Boolean, character and integer. Integral types can not contain a fraction part, they are whole numbers.
Boolean:
Boolean type can represent only two values, true or false.
The Boolean type, which is referred to by the keyword bool, is stored in the memory as 0(False) or 1(True).
Character:
A character is, any value that can be represented in the computers alphabet, or as it is better known as, its character set. The C standard provides two character types: char and wchar_t(wide character type).
Integer:
An Integer type is a number without a fraction part
C supports four different sizes of the integer data type: short int, int, long int and long long int.
Floating-point Types:
There are three floating point types: real, imaginary and complex. There is a standard library, float.h, for the floating point values.
Real:
The real type, holds values that consist of an integer and a fractional part. There are three different sizes of real types: float, double and long double.
Imaginary type:
C, defines an imaginary type. An imaginary number is used extensively in mathematics and engineering. An imaginary number is real number multiplied by the square root of -1(sqrt of -1). The imaginary type, like the real type, can be of three different sizes: float imaginary, double imaginary and long double imaginary.
There are three floating point types: real, imaginary and complex. There is a standard library, float.h, for the floating point values.
Real:
The real type, holds values that consist of an integer and a fractional part. There are three different sizes of real types: float, double and long double.
Imaginary type:
C, defines an imaginary type. An imaginary number is used extensively in mathematics and engineering. An imaginary number is real number multiplied by the square root of -1(sqrt of -1). The imaginary type, like the real type, can be of three different sizes: float imaginary, double imaginary and long double imaginary.
Complex:
C defines a complex type, which is implemented by most compilers. A complex number is a combination of a real and an imaginary number, The complex type, like the real type, can be of three different sizes: float complex, double complex and long long complex.
The following table shows all valid data type combinations supported by C, along with their minimal ranges and typical memory size.
Derived:
Array, pointer, structure and enumeration are called derived data types in C language
Array- a finite sequence of variables of the same data type.
Structure- a collection of related variables of the same or different data types.
Pointer- It is a variable which contains the address of another variable in memory.
Enumeration- An enumeration consists of a set of named integer constants.
It allows a programmer to define their own data type. Keyword enum is used to defined enumerated data type.
Array, pointer, structure and enumeration are called derived data types in C language
Array- a finite sequence of variables of the same data type.
Structure- a collection of related variables of the same or different data types.
Pointer- It is a variable which contains the address of another variable in memory.
Enumeration- An enumeration consists of a set of named integer constants.
It allows a programmer to define their own data type. Keyword enum is used to defined enumerated data type.