With an array of the specified size, the compiler warns me if I put too many elements in the initialization:
int array[3] = {1,2,3,4};
But of course, this is not the case if I put too few elements (it just fills them with 0s):
int array[3] = {1,2};
However, at compile time, I have to ensure that I precisely specify N elements in the initialization of an array of N-elements (this is an array of function pointers).
Can I warn the compiler if I specify too few elements?
source
share