How to Cast Integer Value to Pointer Address Without Triggering Warnings

Viewed 9570

I have the following variable

uint32_t Value = 0x80

0x80 represents an address in the memory e.g.

// Write 2 at address 0x80
*(uint32_t*)((uint32_t)0x80) = 2;

How can i cast Value to a Pointer, so it points to 0x80?

uint32_t *Pointer = ?? Value;

This:

(uint32_t*)(uint32_t)Value;

returns:

warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
2 Answers
Related