C: length.h module.
Usage:
int array[] = {9,4,8,1,7,0,3,2,5,6}; // test array
int length = LENGTH(array);
https://github.com/pereiradaniel/c_programs/blob/master/length.h
#define LENGTH(a) sizeof(a) / sizeof(a[0]) // function-like macro
Usage:
int array[] = {9,4,8,1,7,0,3,2,5,6}; // test array
int length = LENGTH(array);
https://github.com/pereiradaniel/c_programs/blob/master/length.h
#define LENGTH(a) sizeof(a) / sizeof(a[0]) // function-like macro