It is simple I have written the code for you check it.
#include<stdio.h>
int my_strlen(char *str)
{
int rv;
for (rv=0; str[rv] != 0; rv++)
{
}
return rv;
}
int main(int argc, char const *argv[])
{
char str[10]={'H','e','l','l','o','\0'};
printf("\nLength is %d\n",my_strlen(str));
return 0;
}
You can take input using scanf.