I saw one way that I can't understand clearly to declare a variable using C (since it's just little part in the whole embedded system program, I've tried to reproduce it simpler below).
#include <stdio.h> typedef volatile unsigned char XBYTE; #define var (* (XBYTE * )(0x0100)) int main() { printf("Hello World\n"); printf("the address of var is %x\n",&var); return 0; } I'm pretty sure that the fragment is about the "var" which will be allocated at the address 100h, but the question is that I can't tell how it works by pointer.
Besides, is there any potential problem while making a declaration like this?
thanks
#define var (* (XBYTE *)(0x0100))contents of (virtual) storage location 0x0100.varis not a variable, but some l-value