What language are you after?
You can use the sizeof() function in C/C++:
#include <stdio.h>
int main()
{
int array[32];
printf("Size of array: %lu\n", sizeof(array));
printf("Element count in array: %lu\n", sizeof(array) / sizeof(array[0]));
return 0;
}
In other object-oriented languages, such as Java, C#, you typically have a Length or Count property on collections.