Classification Of data types |
- C has five Basic data types -
- Character - keyword used is char.
- Integer - keyword used is int.
- Floating Point - keyword used is float.
- Double precision floating point - keyword used is double.
- Void - keyword used is void.
- C has four type qualifiers also known as type modifiers. They precede the basic data types.
- short
- long
- signed
- unsigned
- A type modifier alters the meaning of the base data type to yeild a new type. The following points should be noted.
- Each of these modifiers can be applied to the base type int .
- The modifiers signed and unsigned can also be applied to the base type char.
- In addition long can be applied to double.
- When the base type is omitted from a declaration, int is assumed.
- A complete list of possible data types is mentioned below.
- bool
- char
- unsigned char
- signed char
- int
- unsigned int
- signed int
- short int
- unsigned short int
- long int
- unsigned long int
- signed long int
- float
- double
- long double
- Then there are three types of Derived data types -
- Array
- It is a collection of similar type of data (or data types) stored in contiguous memory location
- Function
- A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into separate functions.
- Pointer
- A pointer is a variable which contains the address in memory of another variable. We can have a pointer to any variable type.
- Array
- Then there are also three types of User-defined data types -
- Union
- A union is a special data type available in C that allows to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Unions provide an efficient way of using the same memory location for multiple-purpose.
- Structure
- A structure in the C programming language is a complex data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer or variable of type struct. "Class" is c++ is an advanced version of structure.
- Enumeration
- Enumerated Types allow us to create our own symbolic names for a list of related ideas. The keyword for an enumerated type is enum.
- Union
Vishal & Jeevan u hv mentioned da data types in c. I think da data types sd b classified as fundamental,derived & user defined.den da data types u hv mentioned sd fall under those categories.
ReplyDeleteYeah. Actually it is written that "C has five 'basic' data types". I forgot to mention about the three types of derived and user defined data types.
Delete