Need help for this syntax: "#define LEDs (char *) 0x0003010"
- by Noge
I'm doing programming of a softcore processor, Nios II from Altera, below is the code in one of the tutorial, I manage to get the code working by testing it on the hardware (DE2 board), however, I could not understand the code.
#define Switches (volatile char *) 0x0003000
#define LEDs (char *) 0x0003010
void main()
{ while (1)
*LEDs = *Switches;
}
What I know about #define is that, it is either used to define a constant, or a macro, but
why in the above code, there are casting like, (char *) 0x0003010, in #define?
why the 2 constants, Switches and LEDs act like a variable instead of a constant?
Thanks in advance !