Write a program to find the length of a string

//this is a program to find the length of a string
#include<stdio.h>
#include<conio.h>
void main()
{
char string[10];
int i, length=0;

printf("\n\nEnter the String: ");
scanf("%s",string);

for(i=0;i<10;i++)
{
if(string[i]==NULL)
{
break;
}
}

printf("\n\nThe Length of The string is %d",i);

getch();
}

Previous
Next Post »