eepty
Full Member level 2
I am writting a firmware in C for a home appliance. In a C file for the real time clock, the complier reported error with an error message: "constant expression expected in initializer" in line 8 (the declaration of the array):
//In the c file:
1 char now_sec;
2 char now_min;
3 char now_hr;
4 char now_day;
5 char now_weekday;
6 char now_month;
7 char now_year;
8 char now_clock[]={now_sec, now_min, now_hr, now_day, now_weekday, now_month, now_year};
//in the h file:
extern char now_sec; //current second
extern char now_min; //current minute
extern char now_hr; //current hour
extern char now_day; //current day
extern char now_weekday; //current weekday
extern char now_month; //current month
extern char now_year; //current year
extern char now_clock[]={now_sec, now_min, now_hr, now_day, now_weekday, now_month, now_year};
What is wrong here?:?:
Thanks in advance! :grin:
//In the c file:
1 char now_sec;
2 char now_min;
3 char now_hr;
4 char now_day;
5 char now_weekday;
6 char now_month;
7 char now_year;
8 char now_clock[]={now_sec, now_min, now_hr, now_day, now_weekday, now_month, now_year};
//in the h file:
extern char now_sec; //current second
extern char now_min; //current minute
extern char now_hr; //current hour
extern char now_day; //current day
extern char now_weekday; //current weekday
extern char now_month; //current month
extern char now_year; //current year
extern char now_clock[]={now_sec, now_min, now_hr, now_day, now_weekday, now_month, now_year};
What is wrong here?:?:
Thanks in advance! :grin: