Data Types
The data type specifies the type of data that we stored in a variable. It also defines a set of operations on the data. Every data type requires different amount of memory. The compiler allocates memory space for each variable or constant according to its data type.
Categories of Data Types
C language provides two ways to use data types.
Standard Data Type
C language defines some standard data types. A data type that is predefined in a language is called standard data type. Some example of standard data type is int, float, long, char etc.
- Integer data type
int data type, short data type and unsigned data types takes two bytes in memory. Long data type and unsigned long data type takes four bytes in memory.
- Floating point data type
Float data type takes four bytes. double data types takes eight bytes in memory. long double data type takes ten bytes in memory.
- Double
- char
User-defined Data Type
Data types that are defined by user called user-defined data type. C also allows the user to define his own data types.
No comments:
Post a Comment