C programming language provides a rich set of data types to handle different types of data. These data types can be classified into two categories:
-
Primary data types: These are the basic data types that are built-in to the C language. They include int, float, double, char, and _Bool.
-
Derived data types: These are data types that are derived from the primary data types. They include arrays, pointers, and structures.
primary Data Types
1. int
int data type is used to store integer values (whole numbers). The size of an int varies depending on the system, but it is usually 2 or 4 bytes. The range of values that can be stored in an int is -2147483648 to 2147483647.
2. float
float data type is used to store floating-point numbers (numbers with decimal points). The size of a float is 4 bytes. The range of values that can be stored in a float is approximately 3.4 x 10^-38 to 3.4 x 10^38.
3. double
double data type is also used to store floating-point numbers, but it can store larger values than a float. The size of a double is 8 bytes. The range of values that can be stored in a double is approximately 1.7 x 10^-308 to 1.7 x 10^308.
4. char
char data type is used to store a single character, such as a letter or a symbol. The size of a char is 1 byte.
5. Bool
Bool data type is used to store Boolean values (true or false). The size of a _Bool is 1 byte.