Write a c program to find the length of a string without using the built in function

#include<stdio.h>
void main(){
    char s[50];
    int i=0;
    printf("Enter string: ");
    scanf("%s",s);
    while(s[i]!='\0') i++;
    printf("Length = %d",i);
}