Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - What happened when c++ 16 integer output a pointer?
What happened when c++ 16 integer output a pointer?
Because p points to an integer. So p+ 1 equals the value of p plus sizeof(int), and the value of p+9 is the value of p plus 9*sizeof(int). The 32-bit system int is 32 bits, that is, 4 bytes, so it is the value of p plus 36. %x is output in the form of 16, and 36 is converted into 16 as 24. If the first output is 5732, then the second output should be 5732+24, which is 5756.

When I actually run, the first output is 12ff58, and the second output is 12ff7c, which is exactly12ff7c-0/2ff58 = 24 (both in 16).

If it is a system of 16, that is, int takes up 2 bytes, it should be 5732+ 12=5744. I can't figure out under what circumstances I will get 5749.