I am trying to get a sound understanding about how RAM works in most computers. I feel this is a silly question and I might get down votes but im asking anyway.
I am watching videos and reading online but haven't got a straight clear answer.
I just have two questions:
Is Memory cell the same as memory address ? Is there a difference ?
What is the smallest unit of addressable memory -> Here I am getting conflicting info, some say It is 1 byte, some say it is 1 bit.
In C byte seems to be the smallest data type, What if I want to store a variable that either has the value 0 or 1, is there no data type that can store just 1 bit ?
I see even the boolean data type takes 1 byte, even though it could be just 0 or 1?
So would it be fair to say that the smallest unit of addressable memory is a byte and not a bit ?
Thanks
CodePudding user response:
The smallest addressable unit is a byte (in most current computers that you will come accross)
To set a variable to 0 or 1 will require that variable to be at least one byte. But you can use individual bits in one byte for different bits
You do that using bit fields in structs in c or by bit level operations on bytes (or larger)