How to define constant 1 or 2 dimensional array in C/C++? I deal with embedded platform (Xilinx EDK), so the resources are limited.
I'd like to write in third-party header file something like
#define MYCONSTANT 5
but for array. Like
#define MYARRAY(index) { 5, 6, 7, 8 }
What is the most common way to do this?
In C++ source file
extern "C" const int array[] = { 1, 2, 3 };
In header file to be included in both C and C++ source file
#ifdef __cplusplus
extern "C" {
#endif
extern const int array[];
#ifdef __cplusplus
}
#endif