I have some macros defined such as
#define NUM_A 3
#define A1 10
#define A2 100
#define A3 8
The total count and the values are specific to the device. Now I need an array looks like
int Array[NUM_A]={A1, A2, A3};
Now, if the total number, NUM_A changes to 4, and I have defined the macro A4, but I forget to append A4 to the array. The actual Array would be {A1, A2, A3, 0}. There won't be error when compiling. The error is also hard to be found when running the program. It's more likely to be happen when I write the macros in the header file and declare the array in a source file. Can I write a looped macro to generate the array by the defined macros NUM_A, A1, A2 and A3? Or can I write an assert or something else to warn myself if the error occurs when compiling or running?