I writing code for microcontroller and the program look like this, this is not the real program, it is just an example of it to present the problem.
I wanted to show that if I point to a place in memory and define the pointer in the header file, I cant call to the defined array in source file.
test.h:
#define arr * (BYTE *)(0X10000);
int function(int i);
test.c:
#include "test.h"
int function(int i){
arr[5] = 1;
}
and the problem is:
undefined identifier "arr"
How could it be that it can't recognize it?
Let me assume the
0x10000
is an exact beginning address of a register inside your microcontroller and you wish to write there some bytes. Then I would#define
my alias as follows:In this case you may use the
MY_REGISTER
macro as an initializer:Note: the MCU and the compiler are not specified and I have no way to test my answer.