What is Data Type?
A Data Type
is something which describe about data nature. Data type tells the program that
which type of value a Variable will hold and what type of mathematical, relational
and logical operation can be performed on that variable without getting any
error. If variable int x = 45, that means, 45 is integer value which is being
kept in variable x and we could do mathematical operation on it.
There are
basically 5 types of data types, when we are talking about c language.
Int, Float, Double,
Long, char, Boolean, String, etc.
Few data
types which we use often in c language is below:-
Int - Int defines as Integers. In int we can hold any numeric
value. It occupies 4 bytes of memory. Keyword used for Integers value is int.
Float – Float defines as floating point
number. It means we can hold any decimal number in it. It also occupies 4 bytes
of memory. Keyword used for Float point values is float.
Double - Double data type is used for
storing double precision floating point values or simply decimal values.
Keyword used for double floating point data type is double. Double variables typically require 8 byte of memory space.
Long – Long also holds the integers value.
It occupies 8 bytes of memory. Keyword used for Long is long. It is basically use when you have large number to store in
variable.
Character – Character data type hold the alphabet
or any character value in it. Keyword used of Character is char. Character requires 1 bytes of memory space.
Comments
Post a Comment