Assume that an array A contains all the int elements, and the array has three elements.
The expression A + 1 is equal to a [1].
In this case, if an int is stored in two bytes in the system, the expression A + 1 actually uses
The address of a is moved two byte backward. If you want to move the address of a to one byte backward, you can do this.
Unsigned char * P =;
P + 1 ---------------- in this case, the address of a is moved back to 1 byte, because the unsigned char is stored as 1 byte.
There may be a question: What is the difference between unsigned char and Char? As we all know, char is actually an ascii code, which is stored in 8 bits, but the maximum bit is not considered. That is to say, only 1-is defined, more than 128 of the ASCII code is not defined (defined as extended characters); but for unsigned char, more than 128 characters can also be recognized, that is, they will be displayed as extended characters, that is to say, if the highest bit is 1, unsigned char can also be displayed and defined.
In addition, for struct in C, when we reference its internal element, we should not use the address offset method, which should be defined in C syntax. # And-> Number, Because struct has an address alignment when stored in the memory. If we use the struct base address offset backward to get the element, the problem may occur.