0
Why do we need 2 bytes memory for storing a value as integer?
In language c
11 ответов
+ 2
Yes they can float will be 4 bytes because you need the extra bits to store decimal points.
www.tutorialspoint.com/cprogramming/c_data_types.htm
+ 1
I would assume that is just because you need more than one byte to store the the number of possible values an integer can have.
+ 1
Because that is the most efficient. If you only need 2 byte, alicating10 is wasteful. Similarly if you need 2 alicating 1 us insufficient. Therefore you alicante 2.
+ 1
I don't, you said it was. But normally data types have a set size. I am thus assuming that the size of int is 2bytes in C.
I have just ch checked type int can either be 2 or 4 byte.
+ 1
And I have answered. Because 1 byte was deemed insufficient by C's creators as it doesn't offer enough values.
There is no other explanation.
0
Then why can't we take 10bytes..why are we taking exactly 2bytes?
0
how do you know that it is occupying 2 byte?
0
Thnq for your reply!! I have asked why do we need! There must be some reason for 2byte memory allocation of integer values.
0
I think this is not valid reason,sorry! because they can't assign different values for different datatypes like for example..float will occupy 4bytes.
0
Oh thank you!!