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 function prototype in c with example?
What does %d do?
What is memory leak in c?
Why is c still so popular?
What is dynamic memory allocation?
What is the value of h?
What is the purpose of void in c?
What is a substring in c?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
i want to know the procedure of qualcomm for getting a job through offcampus
Explain the use of fflush() function?
Why do some versions of toupper act strangely if given an upper-case letter?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What is time complexity c?
What is function pointer c?