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
Can we assign integer value to char in c?
Wt are the Buses in C Language
What is hashing in c?
Explain #pragma statements.
The statement, int(*x[]) () what does in indicate?
Explain 'bit masking'?
Are there constructors in c?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
What are the modifiers available in c programming language?
How is pointer initialized in c?
What do you mean by dynamic memory allocation in c?
What does 2n 4c mean?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
Is there a way to compare two structure variables?
What is difference between static and global variable in c?