I've a function which takes seconds as input and convert it into into time and date. However I'm experiencing warning about Array Variable 'cumDaysInMonths' may not have been initialized [MISRA 2012 Rule 9.1, mandatory]. I've initialized it and then updated in a loop. The warnings are on both lines and linked.
The initialization is as follows:
unsigned short cumDaysInMonths[MONTHS_IN_A_YEAR] = {0,31,59,90,120,151,181,212,243,273,304,334};
And the usage within loop is as follows:
for(list_index = 2; list_index < MONTHS_IN_A_YEAR; list_index++)
{
cumDaysInMonths[list_index]++;
}
I'm not able to understand the reason of this warning and how to fix it?