+ 1

size of data

why size of data is different for different data type..Again being different then it is depend on compiler.. like 1 byte for char 2 byte for int..why different?? again in 16bit compiler 2 byte for int,in 32 bit,,4 byte..why?

2nd Jan 2017, 2:18 PM
Somnath Ghosh
Somnath Ghosh - avatar
2 Answers
- 1
comptuer understands only 0 and 1...so it stores variables as 0's and 1's example 0: 0 1: 1 2: 10 3: 11 4: 100 etc... also every char has it's own code written in 0 and 1 so every symbol has different lenght of zero's and one's and it takes different amount of memory
2nd Jan 2017, 2:36 PM
Leonida17st
Leonida17st - avatar
- 1
https://www.tutorialspoint.com/cplusplus/cpp_data_types.htm read this page and it should get more clear
2nd Jan 2017, 2:39 PM
Leonida17st
Leonida17st - avatar