If array is static allocated:
size_t size = sizeof(arr) / sizeof(int);
if array is dynamic allocated(heap):
int *arr = malloc(sizeof(int) * size);
where variable size is a dimension of the arr.
int len=sizeof(array)/sizeof(int);
Should work.
_msize(array)
in Windows or malloc_usable_size(array)
in Linux should work for the dynamic array
Both are located within malloc.h and both return a size_t
Source: Stackoverflow.com