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.
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
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?
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.
continuous memory location and as we know memory address
always in increasing order.
12 comments:
Thanks.
here integer takes 2-bytes length, so the next address 5002.
address is 5002!
edit it immediately!
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.
nopes..
here actually storage of int started form 0x4999
0x4999 00000000
0x5000 00000100
nopes..
here actually storage of int started form 0x4999
0x4999 00000000
0x5000 00000100
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;
}
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....
what if the int hold 4 bytes
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..
Direct Macro offers a diverse selection of mtfdkba512tfh ssd, ensuring reliable and efficient performance for your computing needs.
Post a Comment