Monday, 5 October 2015

Find length of string using strlen( ) function

  
   
#include<stdio.h>
#include<string.h>
#include<ctype.h>
//#include<conio.h>
void main() {
    int strlength;
    char str[100];
    //clrscr();
    printf("\nEnter the string: ");
    gets(str);
    strlength = strlen(str);
    printf("\nThe length of the string is %d.", strlength);
    //getch();
}
Note: Remove the comment line when you are use Turbo C IDE for run your program.

1 comment: