+ 2

Question related to memory storage capacity of data type....in C

I found that "int" data type have a two different memory storage capacity like.... 4 byte || 2 byte(which is depend upon type of machine architecture) [1 byte = 8 bits] 1 bits have possible value such as "0" or "1" "0" --> off[0 - 0.5v] "1" --> on[some voltage between 2.5 - 5] Here my question arise.... Why they use(create compiler && OS) which use 4 byte || 2 byte as a memory storage capacity for "int" data type Instead of using 1byte or 3 byte as memory storage capacity for int data type.... What is the reason behind it?why they create like this? Also also please answer me why they(OS) use 1 byte memory location for "char" data type? Also for double, float...etc

7th Nov 2020, 5:13 AM
Yogeshwaran P
Yogeshwaran P - avatar
2 Respuestas
+ 3
Thank you NotAPythonNinja for yours clear explanation......😊
7th Nov 2020, 11:55 AM
Yogeshwaran P
Yogeshwaran P - avatar
+ 1
NotAPythonNinja can you tell why we aren't using sizeof(int) as 1byte? and also tell why 1 byte is enough for char data type.....? please tell me what's the reason behind it
7th Nov 2020, 10:33 AM
Yogeshwaran P
Yogeshwaran P - avatar