Wednesday, 26 August 2015

Write a C Program to Find String Length

Write a C Program to Find String Length
1:  #include<stdio.h>  
2:  #include<conio.h>  
3:  int main()  
4:  {  
5:        char str[100];  
6:        int l;  
7:        clrscr();  
8:        printf("Enter the string:");  
9:        gets(str);  
10:        for(l=0; str[l]; l++);  
11:        printf("The length of %s is -> %d",str,l);  
12:        getch();  
13:        return 0;  
14:  }  

No comments:

Post a Comment