Count length of String:- Function used- strlen .This function is used to count the length of string. Q)Write a program to enter string...
Count length of String:-
Function used-strlen.This function is used to count the length of string.
Q)Write a program to enter string(character array) and count the length of string(without function).
Note:-You can also create this program in c++(c plus plus),java,perl,c#(c sharp) languages etc. with the same logic(Functions may be differ).
P:void main()
{
char string[40];
int i,l;
clrscr();
printf("Enter String");
gets(string);
l=0;
for(i=0;string[i]!='\o';i++)
{
l=l+1;
}
printf("Length of string");
getch();
}
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
COMMENTS