Monday, December 13, 2010

Program to calculate the length of string without using string handling function

/*Program to calculate the length of string*/
/*without using string handling functions*/
#include<stdio.h>
int main()
{
    char string[100];
    int i,count=0;
    printf("Enter the string:");
    gets(string);
    for(i=0;string[i]!='\0';i++)
    {
        count++;
    }
    printf("The length is %d.",count);
    return 0;
}

No comments:

Post a Comment