After doing lot of research in Google
, I found below program
#include
int main()
{
int val;
char *a = (char*) 0x1000;
That is the correct way to write data to memory location 0x1000. But in this day and age of virtual memory, you almost never know the actual memory location you want to write to in advance, so this type of thing is never used.
If you can tell us the actual problem you're trying to solve with this, maybe we can help.