Implement Custom strlen Function

Code

#include<stdio.h>
int main()
{
    int len=0,i=0;
    char str[100];
    scanf("%[^\n]s",str);
    while(str[i++] != '\0')
    {
        len++;
    }
    printf("%d",len);

}

Solving Approach

 

 

 

Upvote
Downvote
Loading...

Input

Embedded

Expected Output

8