C Program to find length of a string without using built in functions

Program

#include<stdio.h>
void main()
{
	char str[20];
	int length;
	printf("Enter a string\n");
	scanf(" %s", str);
	for(length = 0; str[length] != '\0'; length++);
	printf("Length of the string is: %d\n", length);
}

Output

Enter a string
california
Length of the string is: 10