The data type is the classification of data that helps a computer correctly interpret its value.
For example, if we enter “3, pen”, it is the data type that will tell if the computer reads it as ‘3pen’ or ‘number of pens is 3’.
The following table contains some universal data types with examples:-
Data Type(short form) |
Definition |
Example |
||||||||
Integer(int) |
Numeric information without a decimal point |
1,2,3,4,5…. |
||||||||
Floating point(float) |
Numeric information with decimal points |
1.1, 2.2, 3.3, 4.4, etc |
||||||||
Character(char) |
A single letter, digit, punctuation mark, symbol, or blank space |
A, 1, # |
||||||||
string(str) |
The sequence of characters, digits, or symbols—is always treated as text |
Dog, Twitter, 011-123-1234 |
||||||||
Boolean(bool) |
It can have only two values, 0 or 1 |
True(1) and false(0) |
||||||||
Array |
It is a list with elements in a specific order |
Array1-
Array 2-
Here Array 1 and 2 have the same elements but at different locations. |