In this article i will try to explain Data Types,Type and Data Types in easy and simple words.
What is Data Type :
Data Type is nothing but storing the values in a particular variable and that variable describe the type of the value. The value can be any form like Numeric Value, Floating Values, Boolean Values, Char and String Values and so on.
Types of Data Type :
- Numerical Data Types
- Floating Point Data Types
- Character Related Data Type
- Logical Data Types
- General Data Types
1. Numerical Data Types
Numerical Data Types will be 2 types
- Signed Numerical Data Type
- Unsigned Numerical Data Type
Signed Numerical Data Type
Signed Numerical data type contain only Positive and Negative Values and its classified into 4 types.
-
- sbyte
- s-stand for signed
- sbyte predefined size is 1 byte = 1*8 = 8 bits
- base type of sbyte : System.SByte
- sbyte accomodiate the memory min size : -128 and max size : 127
-
- short
- s-stand for signed
- short predefined size is 2 byte = 2*8 = 16 bits
- base type of short : System.Int16
- short accomodiate the memory min size : -32768 and max size : 32767
-
- int
- int predefined size is 4 byte = 4*8 = 32 bits
- base type of int : System.Int32
- int accomodiate the memory min size : -2147483648 and max size : 2147483647
-
- long
- long predefined size is 8 byte = 8*8 = 64 bits
- base type of long : System.Int64
- long accomodiate the memory min size : -9223372036854775808 and max size : 9223372036854775807
Unsigned Numerical Data Type
Unsigned Numerical data type contain only Positive Values only and its classified into 4 types.
-
- byte
- byte predefined size is 1 byte = 1*8 = 8 bits
- base type of byte : System.Byte
- byte accomodiate the memory min size : 0 and max size : 255
-
- ushort
- u-stand for unsigned
- ushort predefined size is 2 byte = 2*8 = 16 bits
- base type of ushort : System.UInt16
- ushort accomodiate the memory min size : 0 and max size : 65535
-
- uint
- uint predefined size is 4 byte = 4*8 = 32 bits
- base type of uint : System.UInt32
- uint accomodiate the memory min size : 0 and max size : 4294967295
-
- ulong
- ulong predefined size is 8 byte = 8*8 = 64 bits
- base type of ulong : System.UInt64
- ulong accomodiate the memory min size : 0 and max size : 18446744073709551615
Q.) Difference between Signed and UnSigned Numerical Data Types
→ Signed Numerical Data Type contain only Positive and Negitive values
→ UnSigned Numerical Data Type contain only Positive values only
2. Floating Point Data Types
→ A number which is having fraction part is called Floating Point Data Type
→ By default Floating Point Data Types are Signed
→ we do not have any Unsigned Floating Point Data Types
→ According to the size floating point data types are classified into 3 types
-
- float
- float predefined size is 4 byte = 4*8 = 32 bits
- base type of float : System.Single
-
- double
- double predefined size is 8 byte = 8*8 = 64 bits
- base type of double : System.Double
-
- decimal
- decimal predefined size is 16 byte = 16*8 = 128 bits
- base type of decimal : System.Decimal
3. Char Data Type
-
- char
- char predefined size is 2 byte = 2*8 = 16 bits
- base type of char : System.Char
4. Logical Data Type
-
- bool
- bool predefined size is 1 bits
- base type of bool : System.Boolean
- true will be stored into memory as binary 1
- false will be stored into memory as binary 0
5. General Data Type
-
- string
- general data type will not have predefined size
- base type of string : System.String
-
- object
- base type of object : System.Object
0 Comments