Check out example codes for "c strlen". 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);
}

Code Example 2

#include <stdio.h>
#include <string.h>
int main()
{
    char a[20]="Program";
    char b[20]={'P','r','o','g','r','a','m','\0'};

    // using the %zu format specifier to print size_t
    printf("Length of string a = %zu \n",strlen(a));
    printf("Length of string b = %zu \n",strlen(b));

    return 0;
}

Learn ReactJs, React Native from akashmittal.com