how to generate the length of a string without using len
funtion?

Answer Posted / shruti

** same as above.. only u should initialise the valued of
varibale len to 0..
otherwise it will pick up some garbage value.. **


int strlength(char s[])
{
int i , len;

len = 0;
for(i = 0 ; s[i] != '/0' ; i++)
{
len++;
}

return len;
}

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the binary height balanced tree?

726


What is calloc()?

629


What are the standard predefined macros?

634


What oops means?

584


What is function and its example?

628






What is the purpose of ftell?

601


Explain how do you generate random numbers in c?

626


Why we not create function inside function.

1750


What is pointer to pointer in c?

635


How can I make it pause before closing the program output window?

581


What is extern storage class in c?

513


What are qualifiers?

617


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2335


What is the purpose of 'register' keyword?

691


What are enumerated types?

656