How do get the array length?

Use the standard C idiom for arrays...

#define MYARRAY_SIZE 10

int myArray[MYARRAY_SIZE];

for (i=0;i<MYARRAY_SIZE;i++) {
  myArray[i] = 0;
}

If you need to pass the array to a function, pass the length also.