![funmioyeopa](/avatars/34904.jpg)
funmioyeopa
05.09.2019 •
Computers and Technology
Write a function strlen_recursive which accepts a pointer to a string and recursively counts the number of characters in the provided string, excluding the null character. this function should return the number of characters in the string.
Solved
Show answers
More tips
- C Computers and Internet How Do You Refill Cartridges?...
- F Family and Home How to Keep Your Home Warm: Tips and Tricks...
- D Dating, Love, Relationships Does a Person s Character Depend on the Color of Their Eyes?...
- O Other Childhood Fears: What Many of Us Experienced...
- H Health and Medicine Simple and Effective: How to Get Rid of Cracked Heels...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
Answers on questions: Computers and Technology
- C Computers and Technology Write a program to calculate the hypotenuse of two right triangles. Create a new project called 02.03 Math Class Methods. Create a class called Theorem in the newly-created...
- C Computers and Technology 2.What are some obstacles did the creator(s) faced? in Microsoft...
- C Computers and Technology Unauthorized use of information, materials, devices, or practices in completing academic activities is generally considered:...
- C Computers and Technology Your manager at work is extremely impressed with your computer skills since you took a computer course. the company is installing computers in its production facility,...
- M Mathematics What is t 7.8−3.5t=1.5...
- M Mathematics After traveling for 4 hours and 1800 miles, an airplane begins a steady descent. When it begins descending, its altitude (height) is 33,000 feet. After 8 minutes,...
- C Chemistry How many moles are in 9.55 x 10 30 atoms of AuCl3?...
- M Mathematics A 4 year old can answer this....
- M Mathematics A 5 year old could answer this. (last question boys)...
- P Physics Week4 Fundamentals of physical science Space diagram template...
Ответ:
Following are the function
int strlen_recursive(char *str1) // recursively counts
{
static int l=0; // static variable
if(*str1==NULL) // string is equal to NULL
{
return(l); // returning length
}
else
{
l++; // increased the length
strlen_recursive(++str1); // recursive function
}
}
Explanation:
Here we are iterating over the loop and check if string is equal to NULL then it return the length of string otherwise it recursively count the length of string.
Following are the code in C language
#include <stdio.h>//heaader file
int strlen_recursive(char *str1) // recursive function
{
static int l=0;// static variable
if(*str1==NULL)
{
return(l); // return length if string is equal to null
}
else
{
l++;
strlen_recursive(++str1); // call recursive function
}
}
int main() // main function
{
char str1[100]; // declaring array
int l=0;
printf("Enter the string: ");
gets(str1);// input string
l=strlen_recursive(str1); // recursive function
printf("Total number of characters are: %d\n",l);
return 0;
}
Output:
Total number of characters are:sa
2
Ответ:
Going to answer below :)
Explanation:
These strangers have arrive to our shore. I warned my brother and told the chief to come take a look. They are strange. I have never seen anything like this. It appears as if they are giant white seabirds or floating islands. Their skin is a different color, very pale. Their hair is the color of fresh ripe corn. In the distance there is something remarkably large swimming, or floating on the water, and I've never seen this before. They immediately returning to the shore apprised their countrymen of what they had seen, and pressed them to go out with them and discover what it might be.