Wednesday, 21 January 2015

C Program to find the length of a string.


This is a C Program to find the length of a String.
Here we use string function strlen() to find the length of a string.
All the string functions are present in the header string.h

PROGRAM :
#include <stdio.h>
#include <stdlib.h>

int main()
{
    char name[40];
    printf("Enter any name(String) : \t");
    gets(name);
    printf("\nThe length of the string you entered is : \t %d" ,strlen(name));
    return 0;
}

OUTPUT :

C Program to find the leegth of a string

No comments:

Post a Comment