# include <stdio.h>
# include <conio.h>
void main()
{
char str[80] ;
int i ;
clrscr() ;
printf("Enter the string : ") ;
gets(str) ;
for(i = 0 ; str[i] != '\0' ; i++) ;
printf("\nThe length of the string is : %d", i) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter the string : welcome
The length of the string is : 7
# include <conio.h>
void main()
{
char str[80] ;
int i ;
clrscr() ;
printf("Enter the string : ") ;
gets(str) ;
for(i = 0 ; str[i] != '\0' ; i++) ;
printf("\nThe length of the string is : %d", i) ;
getch() ;
}
RUN 1 :
~~~~~~~
Enter the string : welcome
The length of the string is : 7
C++ program to Find Length of String
ReplyDeleteLength of String is the number of character in the given String. For Example: String="Language" this string have 8 characters also this string is the size of string.