Datat type are used to define the type of data a variable will store in it and what is the range of variable (menas how much values a variable can store)
Different types of datatypes
1. Integer
2. Character
3. Float
4. Double
Memory Size
8 bits = 1 byte
1024 bytes = 1 kb
1024 kilobyte = 1Mb
ASCII (American Standarad Code for Information Interchange)
basically it defines the size of the letters, symbols, numbers
there are basically 8 bits in computer 128 64 32 16 8 4 2 1
ASCII value of a =65 (01000001), means a will need 65 bits in computer memory to store values
size of small letters in computer
a - 65 b - 66 c - 67 d - 68 e - 69
f - 70 g - 71 h - 72 i - 73 j - 74
k - 75 l - 76 m - 77 n - 78 o - 79
p - 80 q - 81 r - 82 s - 83 t - 84
u - 85 v - 86 w - 87 x - 88 y - 89
z - 90
Char = 2 byte (16 bits)
Range of char is 2Pow(n-1) i.e. 2 Pow (7) =128
where n in no. of bytes an variable can hold,
so char ranges from -128 to +128
char can only store one value, since char only store alphabets, and alphabet have size 65+
so char cannot hold two alphabets a+a= 65+65 = 130 but char ranges from -128 to +128
No comments:
Post a Comment