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
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
Can you explain the four storage classes in C?
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
what is uses of .net
What is static volatile in c?
How to write c functions that modify head pointer of a linked list?
Explain how does flowchart help in writing a program?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.
Where are some collections of useful code fragments and examples?
What is difference between stdio h and conio h?
how to introdu5ce my self in serco
How can I rethow can I return a sequence of random numbers which dont repeat at all?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
What is a MAC Address?
What is .obj file in c?