I am writing a C function, but when I compile it with -Wall flag, it complains as follows:
warning: ‘sizeof’ on array function parameter ‘dayarray’ will return size of ‘const long int *’ [-Wsizeof-array-argument]
C Function
static int get_month_and_day(const long dayarray[], const size_t dayofyear, long* month, long* dayofmonth)
{
unsigned char found = 0 ;
const size_t numelements = (sizeof dayarray)/ (sizeof *dayarray) ;
...
}
What would be a better way of determing the number of elements in the variable dayarray
?.