Let us see an example code to understand this concept. This question is one of the best questions of the embedded C interview question.
Suppose in an application, you need to access a fixed memory address. So you need to follow the below steps, these are high-level steps.
//Memory address, you want to access
#define RW_FLAG 0x1FFF7800
//Pointer to access the Memory address
volatile uint32_t *flagAddress = NULL;
//variable to stored the read value
uint32_t readData = 0;
//Assign addres to the pointer
flagAddress = (volatile uint32_t *)RW_FLAG;
//Read value from memory
* flagAddress = 12; // Write
//Write value to the memory
readData = * flagAddress;