I want to create a array with the size that is calculated in the preprocessor by means of defines. When I try to initialize this array "memory" the following error appears:
error: expression must be an integral constant expression
This look the me that the expression that gives the size appears to be variable, which is weird because it is calculated from defines. See the following code:
#define SAMPLE_FREQUENCY_HZ 48000
#define SAMPLE_INTERVAL_MS ((1.0 / SAMPLE_FREQUENCY_HZ) * 1000.0)
#define MAX_DELAYLINE_LENGHT_MS 250
#define MAX_DELAYLINE_LENGHT_ELEM (MAX_DELAYLINE_LENGHT_MS / SAMPLE_INTERVAL_MS)
typedef struct {
float delay;
int size;
// float *memory;
float memory[MAX_DELAYLINE_LENGHT_ELEM];
float *start;
float *end;
float *writePointer;
float *readPointer;
} delayline_t;
Could someone explain the problem en give me a solution the solve this in a need way. Thanks!