Datatypes
Datatypes
Pre-defined Datatypes:
* Also called as Premitive datatypes.
* These datatypes will allows us to create a variable that can store one value.
* These datatypes will have fixed size of memory
datatype Type Size Range
char character 1Byte -128 to +127
short integer 1Byte -128 to +127
int Integer 2Bytes -32768 to +32767
long Integer 4Bytes -2^31 to + 2^31-1
float Floating 4Bytes -3.47 E^38 to +3.47 E^38
double Floating 8 Bytes -1.7 E^308 to -+1.7 E^308
long double Floating 10Bytes
Note :datype sizes from above table are based on 16bit system.
If you are using 32bit /64bit system , then
short has 2 Bytes
int has 4Bytes
long double has 16Bytes
Derived Datatypes:
* These datatypes are created by using predefined datatypes.
* Used to increase the capacity of primitive datatypes.
* C supports the following Derived datatypes
1.Arrays: Used to store group of values
2.Functions: used to store group of instructions
3.pointers : used to store and manipulate memory locations
User-defined datatypes:
* These datatypes are created by the programmer.
* These datatypes can store different types of values
* These datatypes have user defined memory size.
* C supports the following User defined datatypes
1.Structures
2.Unions
* create a variable with the name price that can store a float value.
float price;