how to generate the length of a string without using len
funtion?
Answer Posted / poornima
#include<stdio.h>
int strlength(char *);
int main()
{
char *str;
int len;
printf("Enter a string : ");
gets(str);
len=strlength(str);
printf("Length of %s is %d",str,len);
return 0;
}
int strlength(char *str)
{
int len=0;
for(;*str!='\0';str++)
{
len++;
}
return len;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
what is the difference between class and unio?
what is different between auto and local static? why should we use local static?
How can a process change an environment variable in its caller?
Why we use int main and void main?
What is the difference between printf and scanf )?
What is a global variable in c?
Explain what standard functions are available to manipulate strings?
How is = symbol different from == symbol in c programming?
What is a MAC Address?
Is it fine to write void main () or main () in c?
What is register variable in c language?
How can I discover how many arguments a function was actually called with?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
Did c have any year 2000 problems?
What is character set?