Data Types
Data Types
• _Bool
• _Complex
• _Imaginary
• float
• double
We use the keyword "float" to represent floating-point data type and "double" to represent
double data type in c. Both float and double are similar but they differ in the number of decimal
places. The float value contains 6 decimal places whereas double value contains 15 or 19 decimal
places. The following table provides complete details about floating-point data types.
Character data type
The character data type is a set of characters enclosed in single quotations. The following table
provides complete details about the character data type.
The following table provides complete information about all the data types in c programming
language...
void data type
The void data type means nothing or no value. Generally, the void is used to specify a function
which does not return any value. We also use the void data type to specify empty parameters of
a function.
Arrays Arrays are sequences of data items having homogeneous values. They have
adjacent memory locations to store values.
Pointers These are powerful C features which are used to access the memory and deal
with their addresses.
Structure It is a package of variables of different types under a single name. This is done
to handle data efficiently. "struct" keyword is used to define a structure.
Union These allow storing various data types in the same memory location.
Programmers can define a union with different members, but only a single
member can contain a value at a given time. It is used for
Enum Enumeration is a special data type that consists of integral constants, and each
of them is assigned with a specific name. "enum" keyword is used to define the
enumerated data type.
Example:
#include <stdio.h>
#include <limits.h>
int main()
{
printf("Storage size for int is: %d \n", sizeof(int));
printf("Storage size for char is: %d \n", sizeof(char));
return 0;
}
Program Output: