Learn Data Types in C Programming With Examples
Datatypes
Datatypes are used to identify the type of data or which allocates the sufficient memory space for the Variable.
These Datatypes are classified into following types:
1.Primitive Datatypes
2.Derived Datatypes
3.User Defined Datatypes
Primitive Datatypes:
Primitive datatypes are used to store the single value at a time
Example:
int x=10;
int y=10,20;(invalid)
In C Language These Primitive datatypes are classified into following types
1.Integer Datatype
2.Floating Point Datatype
3.Character Datatype
4.Boolean Datatype
Derived Datatypes:
These are used to store the more than one value similar type
Example:
Arrays
int marks[20]={10,20,30,40,50};
char x[20]={'a','b','c','d'};
User Defined Datatypes:
These are used to store the more than one value dissimilar type
Example:
struct, union
struct Demo
{
int x;
float y;
char z;
}
union Demo
{
int x;
float y;
char z;
}