Question related to memory storage capacity of data type....in C | Sololearn: Learn to code for FREE!

+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

11/7/2020 5:13:30 AM

Yogeshwaran

2 Answers

New Answer

+3

Thank you NotAPythonNinja for yours clear explanation......😊

+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