Write own version of the " strlen( ) " library function which is named mystrlen( )

How To Write own version of the " strlen( ) "  library function which is named mystrlen( ) in C Programming Language ?


Solution For Write own version of the " strlen( ) "  library function which is named mystrlen( ):

#include<stdio.h>
int mystrlen(char a[]);
int main(void)
{
    char a[999999];
    gets(a);
    int x=mystrlen(a);
    printf("%d",x);
    return 0;
}
int mystrlen(char a[])
{
    int i,counter=0;
    for(i=0;a[i]!='\0';i++)
    {
        counter++;
    }
    return counter;
}


Learn More :