int a[10];You can do:
nElements = sizeof(a) / sizeof(a[0]);This is a nice idiom. Its better than:
#define N_ELEMENTS (45)
int a[N_ELEMENTS];
nElements = N_ELEMENTS; // Not 100% sure that N_ELEMENTS was use to declare a (in a big program)In Java you can just do:
a.length