#include "mbed.h"
Serial pc(USBTX, USBRX);
int year=2012, month=6, day=12, ndays=0;
int DaysPerMonth[12];
int main() {
pc.baud(38400);
if (year%4 == 0 && !(year%100 == 0 && year%400 != 0)) {
int DaysPerMonth[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
} else {
int DaysPerMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
}
for (int i=0; i<(month-1); i++) {
ndays += DaysPerMonth[i];
}
ndays += day;
printf("day number = %d %d \n", ndays);
}
trying to work-up a function to calculate day number. when compiled, I always get this error
"variable "DaysPerMonth" was declared but never referenced". despite the error, it will load
but when run the arrays are not accessed and in this instance the answer is always 12.
what gives? can anyone explain this to me (and perhaps a work around) ?? tnx very much ...
trying to work-up a function to calculate day number. when compiled, I always get this error "variable "DaysPerMonth" was declared but never referenced". despite the error, it will load but when run the arrays are not accessed and in this instance the answer is always 12. what gives? can anyone explain this to me (and perhaps a work around) ?? tnx very much ...
garyb