Check out example codes for "c number of elements in array". It will help you in understanding the concepts better.

Code Example 1

int my_strlen(char *str) {
  int i = -1;
  
  while (str && str[++i]);
  return (i);
}

Learn ReactJs, React Native from akashmittal.com