-
Preprocessor question
Hi Experts!
I have a quiestion...
1. in my header-file there is:
#define SENSOR_0 0xe0
#define SENSOR_1 0xe2
#define SENSOR_2 0xe4
#define SENSOR_3 0xe6
#define SENSOR_4 0xe8
#define SENSOR_5 0xea
#define SENSOR_6 0xec
with this macro-function:
#define getSensAdr(NR) SENS_ADR_##NR
if i write this code on my c-file
getSensAdr(5)
i get the right value (0xea)
The problem is if i use a variable to get the address of the define like this:
int i=5
getSensAdr(5)
then i get this error message (by the way i'm using gcc as my compiler)
../sensor.c:46: error: 'SENS_ADR_i' undeclared (first use in this function)
do you know if there is any way to solve this problem?
sorry about my english
thank u very much!
Popular pages
Recent additions
Tags for this Thread