Home > Back-end >  C language for beginners have a little doubt about the address
C language for beginners have a little doubt about the address

Time:01-10

If a variable of type int for four bytes, such as the first address is 2000, the first address of a variable is 2004, and to take the address take it to the first address is 2000, if I put an integer variable assignment was $2001, or 2002 anyway, is still in the storage unit of the first variable, so is it possible to access to the variable?
Is the * 2001 can access the first address is 2000 variables

CodePudding user response:

Can't
Said the first address will be the first, and in addition to alignment problem,

CodePudding user response:

Should be related to hardware, seems a little hardware must demand byte alignment, that is to not aligned address assignment, such as: 2000, but 2001 is illegal,
  • Related