What is the ram of a computer?


What is the ram memory: Memory cell in computer

Entire RAM has divided in numbers of equal parts, which are
known as memory cells. Following diagram represents the 256
MB RAM.


Each cell can store one-byte data. Data are stored in the
binary number system. That is a character data reserves one
memory cell while floating data reserves four memory cells.

Each memory cell has unique address. Address is always in
whole number and must be in increasing order. We will discuss
how a characters, integers etc. data are in stored in the
data type chapter. Just for now assume

int a = 4;

Here variables a stores in the memory in the flowing way:


If you know memory address of first cell is 0x5000 then
what would be the memory address of next memory cell?

It will 5001 since integer data always stores at
continuous memory location and as we know memory address
always in increasing order.




C tutorial home.

12 comments:

dinhpq said...

Thanks.

Anonymous said...

here integer takes 2-bytes length, so the next address 5002.

Omkar T said...

address is 5002!
edit it immediately!

Omkar T said...

Sorry it's absolutely correct i think!
If we take array of int like this..

int[2] a;

memory allocated for 2 sequential variables.

In C, int is 2 bytes.

completely 4 cells are allocated!
2 cells - 1 variable
2 cells - another 2nd variable.

1st variable: 1st cell address is 100,
2nd cell address is 101.
then
2nd variable 1st cell address is 102.
2nd cell address is 103.

prashant aggarwal said...

nopes..
here actually storage of int started form 0x4999
0x4999 00000000
0x5000 00000100

prashant aggarwal said...

nopes..
here actually storage of int started form 0x4999
0x4999 00000000
0x5000 00000100

matheen smart vip said...
This comment has been removed by the author.
matheen smart vip said...

compile this:

#include

int main()
{
int ptr=5;
printf("%X\n%X",ptr,&ptr+1);
ptr=ptr+1;
printf("\n%X\n%X",ptr,&ptr+2);
ptr=ptr+1;
printf("\n%X\n%X",ptr,&ptr+3);

return 0;
}

Nayan Mani Baruah said...

Hello friends its not clear to me why 00000100 is not stored in the second byte, like normally we do in binary number system 00000000 00000100 ,is there any kind of big endian or little endian concept out here....

Brandon Hudson said...

Nice and very helpful information i have got from your post. Even your whole blog is full of interesting information which is the great sign of a great blogger.

Acer - 11.6" Chromebook - 4GB Memory - 320GB Hard Drive - Iron Gray

Acer - 11.6" Chromebook - 4GB Memory - 320GB Hard Drive - Iron Gray (C710-2487)

Anonymous said...

what if the int hold 4 bytes

burra prasanth said...

My understanding is like this.
int a = 4;
means a = 0X 0004; => 00000000,00000100;
Since little endian.....Lower Byte in Lower Address and Higher Byte in Higher Address.
So if lower byte 00000100 address is 5000......higher byte 00000000 address is 5001....
is it ok?

..BURRA..