Data Types in C
- Data types determine the type of data a variable can hold. Data types are the means to identify the type of data and associated operations of handling it.
- Example: if a variable 'x' is declared as 'int', the 'x' can hold only integer values.
- Data types are divided into three,
- The system defined data types
- Derived data types
- User-defined data types
The system defined data types
- System defined data types are the data types defined by the c compiler.
- System defined data types can be divided as
- Numeric-integers, float
- character-single characters, string characters
Derived data types
- These data types can be declared by the user by deriving the system-defined data type concepts.
- Examples: Arrays, pointers.
- Arrays: Collection of the same type of data referenced by a common name.
- pointers: A variable that can hold the address of a memory location. The declaration of the pointer should consist of data type, an * (asterisk) and the variable name.
User-defined data types
- These data types can be defined by the user.
- Three types:
- Type modifiers are the keyword used along with the basic data types to extend the range of data handled by the basic types.
- The type modifiers of C are
||size of the char array