To find out the length of a string, we follow the following step -
int main()
{
char str[30],i,cnt=0;
printf("Enter A String: ");
gets(str);
for(i=0;str[i]!='\0';i++)
{
cnt++;
}
printf("Length of the string is %d",cnt);
return 0;
}