-3

Well, I actually don't know how I should describe this:

uintptr_t * ptr = (uintptr_t *) 0x21CC9004;

std::cout << ptr + 0x10 << std::endl;
std::cout << std::hex << 0x21CC9004 + 0x10 << std::endl;

The first line yields 21CC9044 and the second line yields 21CC9014.

How is that? Can someone explain this and how I can add 0x10 to my pointer to get the result from the second line?

1 Answers1

1

In the first case the pointer arithmetic is used. It means that adding 0x10 actually adds 0x10 * sizeof( unsigned int ) to the value of the pointer that is equal to 0x40 provided that sizeof( unsigned int ) = 4.

In the second case there is the usual arithmetic of integer numbers.

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335