1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anastasy [175]
4 years ago
6

Write a function strlen_recursive which accepts a pointer to a string and recursively counts the number of characters in the pro

vided string, excluding the null character. This function should return the number of characters in the string.
Computers and Technology
1 answer:
Over [174]4 years ago
7 0

Answer:

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

You might be interested in
What is the sentinel value in the following code snippet?
Airida [17]
The answer to the problem is 5
7 0
3 years ago
Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of
OlgaM077 [116]

Explanation:

See the attached image for The interface (.h file) of a class Counter

8 0
4 years ago
"What is the longest time (with extensions) a developer can have to file a final map after receiving tentative map approval?"
lesya [120]

Answer:

The answer is "Five years (Two years)".

Explanation:

It supplies with proactive maps of approved modifications beyond the limits of plan may be expanded by the submission of final maps, reflecting the stages of the initial proactive plan, up to ten years with both the chief administrator.

  • Its provisional submission of a map, that will include the request forms or other resources provided at the request of the city administrator and the office.  
  • It also allows the phasing for the current map, that has been accepted.

3 0
3 years ago
__________ is the order of arrangement of files and folders.
lesya692 [45]

sequence is the order of arrangement of files and folders.

6 0
3 years ago
An IT engineer is planning a website upgrade with load balancing features. What technology is used? A) Web Proxy B) Round Robin
BlackZzzverrR [31]

Answer: (B): Round Robin

Explanation: Load Balancing refers to the systemic and effective distribution of network or application traffic across multiple severs in a sever farm. Every algorithm that balances load sits between the client's device and the back end severs.

Load Balancers are majorly used to increase the reliability and capacity of applications.

Round Robin is a type of algorithm that can be used to upgrade a website with load balancing features. It is the most widely used load balancing algorithm and it is a simple way to distribute requests across a group of servers.

3 0
3 years ago
Other questions:
  • System memory is on a computer motherboard?
    14·2 answers
  • PLEASE HURRY
    6·1 answer
  • ________-generation languages use symbols and commands to help programmers tell the computer what to do.
    11·2 answers
  • Josh wants to sign up for a gaming website. It will allow him to download games. He can’t find a privacy policy. Should he join
    9·2 answers
  • Which is a characteristic of multimedia systems?
    7·1 answer
  • When would you insert a merge field?
    10·2 answers
  • Question 10
    14·1 answer
  • A radio and communications security repairer is responsible for both radio and satellite communication systems.
    6·2 answers
  • A falsh movies consist of how many frame? ​
    12·2 answers
  • Alice's public key, and sends back the number R encrypted with his private key. Alice decrypts the message and verifies that the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!