Code: static unsigned int timer[num_timers];
Error: TIMER_MODULE.C(6): error C221: non-constant case/dim expression
An error has been generated while declaring an array in static.
Or else help me out with " an initial value of the array's element should be zero." what should I do?
Show the full code, and the full error message(s).
Use copy & paste - do not manually re-type.
Pay attention to the instructions for posting code
You have tried to use a variable "num_timers" to specify the size of an array.
You can't.
You need to use a constant value.
Valid:
static unsigned int timer[10];
#define NUM_TIMERS 10 static unsigned int timer[NUM_TIMERS];
enum { NUM_TIMERS = 10; }; static unsigned int timer[NUM_TIMERS];