Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- int intvar = 5;
- printf("address of intvar = %p\n", (void *)(&intvar));
- printf("address of intvar - 1 = %p\n", (void *)(&intvar - 1));
- printf("address of intvar + 1 = %p\n", (void *)(&intvar + 1));
- uintptr_t z = uintptr_t(&intvar);
- unsigned short *addr = (unsigned short *)z;
- *addr = 100;
- uintptr_t p = uintptr_t(&intvar);
- int value = *reinterpret_cast<int *>(p);
- printf("value of address = %d\n", value);
- system("pause");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement