timeInDay
我想用尽可能少的行返回我的自定义结构对象数组,以便在我的时间表中返回一天。
struct timeInDay[] getRingTimesForWeekDay(int day) {
switch (day) {
case MONDAY: return { {7, 50} };
case TUESDAY: return { {7, 50} };
case WEDNESDAY: return { {7, 20} };
case THURSDAY: return { {7, 50} };
case FRIDAY: return { {7, 50} };
case SATURDAY: return { {7, 50} };
case SUNDAY: return { {7, 50} };
}
}
struct timeInDay {
unsigned short hour;
unsigned short minute;
};
现在它会产生一个带有方法返回值的错误:
error: decomposition declaration cannot be declared with type 'timeInDay'
struct timeInDay[] getRingTimesForWeekDay(int day) {
如果有人能用尽可能少的行写下他们的做法,将不胜感激。