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
Why isnt there a numbered, multi-level break statement to break out
What are the disadvantages of external storage class?
What is a pointer on a pointer in c programming language?
What is logical error?
What is structure pointer in c?
What does the message "automatic aggregate intialization is an ansi feature" mean?
What is the heap in c?
What should malloc() do?
What is a sequential access file?
When should a type cast be used?
What's the total generic pointer type?
How do you declare a variable that will hold string values?
Is c call by value?
When do we get logical errors?
Is null valid for pointers to functions?