Home > Back-end >  Please answer
Please answer

Time:03-06

Pointer refers to address, such as int pointer, but the memory unit is 1 byte, and that the int pointer refers to the address of the first of four bytes?

CodePudding user response:

What is the first?
If mean minimum value is the address of the, then the int pointer refers to the address of the first of four bytes,

CodePudding user response:

 int I=1; 
Int * PI=& amp; i;



From the picture above you can see, int the pointer to the value of PI is 0 x6ffc1c, and saved in the address is a byte, or 0 x01

CodePudding user response:

Pointer to an int type is 4 bytes (32-bit system) of the first address, your first refers to the first byte, so to understand, but pay attention to consider the size of the problem, the first own position may not be the same ~

CodePudding user response:

Int I=0 x12345678;
//assume & amp; I has a value of 0 x006ffc1c
In the memory address since the childhood:
Big end store
0 x006ffc1c: 12
0 x006ffc1d: 34
0 x006ffc1e: 56
0 x006ffc1f: 78
The small end storage
0 x006ffc1c: 78
0 x006ffc1d: 56
0 x006ffc1e: 34
0 x006ffc1f: 12
  • Related