Get Off-Campus Placement Jobs Info !!!
Programs asked in Mettl Coding Round
Click To Practce List of Programs asked in Nagarro !!!

Program Discussion :: Strings

Home > Programs > Strings

9 / 59

Write a recursive function to find the length of the of string.

Answer:

#include 
#include 
using namespace std; 
int stringLength(char *str)
{
    static int length=0;
    if(*str!=NULL)
    {
        length++;
        stringLength(++str);
    }
    else
    {
        return length;
    }
}
int main()
{
    char str[100];
    int length=0;    
    cout

Asked In :: PEOL

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here: