Search your topic here

Data types

Data Type:

Data type shows the type of memory in which data stay.

For example:

int a = 10;


‘a’ is an variable, in common language it is name of memory in which data 10 stored.

‘10’ is a data which getting stored in ‘a’, ‘10’ is of ‘int’ type.

‘int’ is showing which type of data memory ‘a’ will store. ‘Int’ represent to the integer which only non decimal numbers will stored in memory.

There are 2 different types of Data types:

1) Primitive Data Types:

These are the basic type of data types from which other types of data types are build.

For example:
int, float, double, char, void.

Int- Integer, a whole number.
float - a decimal number.
double - a double-precision float.
char - a single character.

2) Non-primitive(Derived) Data Types:

As the name indicated derived data types are derived from primitive data types.

For example:
Pointer, Array, Structure, Union, Function types, etc.

Program for primitive data types:
int main()
char b ='G';
int a = 1;
double c = 3.14;
float f = 2.1;
printf("char value is %c \n", b);
printf("int value is %d \n", a);
printf("double value is %lf \n",c);
printf("float value is %f \n",f);
return 0;


char value is G
int value is 1
double value is 3.140000
double value is 2.100000